Skip to content

Macro expansion is self-contained #22

@joesavage

Description

@joesavage

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;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions