On 10/05/2013 07:37, Gilles wrote:
> Hi,
>
> I'm trying to find a automated way of defining a macro, depending on
> another macro's value. More precisely, I try to define for "BAR" the
> larger power of 2 strictly smaller than "FOO", up to 2048.
>
> Here is my sample code:
>
> -------------8<--------------------------------------------------
> #include <stdio.h>
>
> #if FOO > 1024
> #define BAR 1024
> #elif FOO > 512
> #define BAR 512
The first two tests check "FOO"
> #elif F00 > 256
> #define BAR 256
This test checks "F00" - 'F' followed by two zeroes
> #elif FOO > 128
> #define BAR 128
> #elif FOO > 64
> #define BAR 64
These tested "FOO"
> #elif F00 > 32
> #define BAR 32
What did this test?
etc...
Was this a rather odd troll? I find it hard to see how you'd mistype
this way.