Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Macro expansion is self-contained #22

Open
joesavage opened this issue Jun 2, 2016 · 0 comments
Open

Macro expansion is self-contained #22

joesavage opened this issue Jun 2, 2016 · 0 comments

Comments

@joesavage
Copy link

The following snippet outputs '10' rather than the expected value of '1' due to the way macro expansion is handled incorrectly in the interpreter:

#include <stdio.h>

#define NUM_ONE   0
#define NUM_TWO   1
#define NUM_THREE NUM_ONE + NUM_TWO

int main(void) {
    printf("%d\n", 10 * NUM_THREE);
    return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant