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

Character constants are incorrectly typed #23

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

Character constants are incorrectly typed #23

joesavage opened this issue Jun 2, 2016 · 0 comments

Comments

@joesavage
Copy link

joesavage commented Jun 2, 2016

Character constants in C should be of the int type (see C99 §6.4.4.4 paragraph 10), yet using picoc the following snippet produces '1' in cases where it should produce '0' (e.g. when sizeof(int) == 4 and sizeof(char) == 1):

#include <stdio.h>

int main(void) {
    char input = 'A';
    printf("%d\n", sizeof(input) == sizeof('A'));
    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