Compiler bug or C standard change?
Rick Murray (539) 13840 posts |
DDE, C compiler version 5.82 (3rd April 2020). The following code compiles without any warning: if ( poll->data.mouse.icon != -1 ) { // Yes, so do something with it window_claimfocus(calcwin); iconblock *icn = (iconblock *)calcwin->icons[poll->data.mouse.icon]; appcalc_process(icn->data[0]); } The problem? I had a fat fingered moment (sadly, I can’t blame alcohol) and stuck the call to window_claimfocus() before the local declaration. Surely declarations used in a block of code should come first? |
André Timmermans (100) 655 posts |
That’s only true for old C versions, starting with IIRC C99 declarations can be made anywhere within a block. |
Rick Murray (539) 13840 posts |
Gee, it’s like BASIC then. ;-)
I’m more or less the same. I like the |
André Timmermans (100) 655 posts |
Another useful feature in C99 is macro ellipsis. |