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

Preprocessor constants should be preserved, not expanded #1

Open
deathcap opened this issue May 4, 2016 · 1 comment
Open

Preprocessor constants should be preserved, not expanded #1

deathcap opened this issue May 4, 2016 · 1 comment

Comments

@deathcap
Copy link
Owner

deathcap commented May 4, 2016

The usage of the C preprocessor causes macro constants to expand in the transpiled output, undesirably. For example:

#include <stdio.h>

int main(int argc, char **argv) {
    exit(EXIT_FAILURE);
}
function main(argc, argv)
{
  exit(1);
}

would rather have exit(1) be exit(EXIT_FAILURE), possibly with a prior const EXIT_FAILURE = 1 definition.

@deathcap
Copy link
Owner Author

deathcap commented May 6, 2016

#define FOO 1 should transpile to const FOO = 1;, but #define foo(a,b) (a+b) to const foo = (a,b) => a + b;. Probably need a C preprocessor parser to do this, or somehow to interface with it, see GH-3.

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