4 ms·
That's a good catch. The moral of the story is that unless your macro definition expands to a single token (e.g #define X 123) you should always, always, always
by bjourne 3y ago
That's a good catch. The moral of the story is that unless your macro definition expands to a single token (e.g #define X 123) you should always, always, always surround it with parenthesis. Because C's precedence rules are damn complicated.
- mananaysiempre 3y ago> Because C's precedence rules are damn complicated. This particular part is not actually complicated: the postfix operators bind the most tightly, then the prefix ones, then the infix ones. (The last part is quite messy, though.) So (int)x[y] parses the same way as, for example, *p++, which should be familliar to a C programmer.