>> I did some digging and found that Depth is a structure defined in Xlib.h:
>>
>> /*
>>  * Depth structure; contains information for each possible depth.
>>  */
>> typedef struct {
>>         int depth;              /* this depth (Z) of the depth */
>>         int nvisuals;           /* number of Visual types at this depth */
>>         Visual *visuals;        /* list of visuals possible at this depth */
>> } Depth;
>>
>> It clearly does not make sense to use Depth as an int in light of this...
>>
>
> Hmm, you didn't tell us the compiler message about this, did you?
>
> That problem didn't happen so far ...
>

This test file fails to compile on Mac OS X:

#include "/usr/X11R6/include/Xlib.h"

void test() {
    int Depth=0;

    Depth++;

    return;
}


gcc -c test.c     gives the following:

test.c:6: syntax error, missing `;' after `Depth'
test.c:6: illegal expression, found `;'


Adding more blank lines between 'int Depth=0;' and 'Depth++;' does not
make any difference.

But adding a semi-colon anywhere between the two does allow it to compile.

It's a mystery to me...!

It could quite possibly be a bug in Apple's version of gcc...?

In the sense that it has found this struct (Depth), which 'standard' gcc is
somehow ignoring within the function even though it could be seen as rather
ambiguous (not by any intelligent programmer, of course), and is actually
picking up on it and trying to 'fit it' into this code. And then the extra
semi-colon somehow allows it to revert back to the 'standard' behaviour??

Guesswork, here...

Bye!

Adrian

Reply via email to