I have a question that would be stupid but... I need to calculate some values at compilation time not at execution time. For instance: DX is a constant defined somewhere as #define DX 120. Under normal situation every command using DX such tft.setCursor(x+DX, y) will solve x+DX at execution time causing a general delay... Since DX is a constant how to solve x+DX at compilation time instead ?

is x a CONSTANT in 'tft.setCursor(x+DX, y)'?

if x value varies in your code, then 'x+DX' how can the compiler know what value of 'x' to use at compile time. it can only be evaluated at execution time unless you specify the value for each and every possible 'x+DX' IMHO

Hi,

AntonioTesta:

I need to calculate some values at compilation time not at execution time.

Why?

What is the application?

What is so special about compilation time?

Tom....

sherzaad:

is x a CONSTANT in 'tft.setCursor(x+DX, y)'?if x value varies in your code, then 'x+DX' how can the compiler know what value of 'x' to use at compile time. it can only be evaluated at execution time unless you specify the value for each and every possible 'x+DX' IMHO

You are right. That is why I suspected the question was stupid !!! x value varies. So of course there is no way to do that at compilation time. Thanks anyway.

if you don't want to perform the addition, may be there is a way to work so that all x are offset by DX from the start.

Addition is performed extremely efficiently by the processor. Have a look at the TFT library for a shock about how efficiently your parameters are being processed. Have you done any benchmark testing with/without the addition?