Skip to content

Character constants are incorrectly typed #23

@joesavage

Description

@joesavage

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

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