DDE 31c C compiler bug
Colin (478) 2433 posts |
The program below prints ‘test1’ – it shouldn’t print anything. I tried other old compiler versions it’s still there at DDE27 – probably always been there. Change the name in main to _e and ‘test3’ is printed. In 2 minds as to whether it is a trap or a bug.
|
Stuart Swales (8827) 1357 posts |
They joys of macro substitution vs inline functions, huh? Write out what the compiler preprocessor would produce: int main(void) { _kernel_oserror* e = NULL; // vv for test1(e); do { _kernel_oserror* e = e; if (e != NULL) { printf("test1\n"); } } while (0); ... return 0; } Which e? The one in that block. |
Rick Murray (539) 13840 posts |
And a gentle reminder that C’s roles on what local scope is isn’t the same as BASIC. ;) |