Skip to content

the sizeof operator should accept any expression #210

Open
@chqrlie

Description

@chqrlie

sizeof currently only accepts a restricted set of arguments: builtin types, identifiers and member expressions (referring to types or variables). Allowing more general expressions is necessary to implement safer allocation and copy idioms:

    MyType *p;
    [...]
    p = malloc(length, sizeof(*p));

similarly:

    string.memset(array, 0, length * sizeof(*array));

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions