appleseedlab/maki

Add SizeOf property

Closed this issue · 0 comments

Maki should report when a macro is invoked inside a sizeof expression.
Macros don't have a size, so downstream translation tools should not translate macros invoked in sizeof expressions to C code because doing so would give them a new size possibly different from the size of whatever value the macro originally expanded to.
This is especially true of macros defined to string literals since sizeof returns the length of the literal, however Maki's translation would change the macro to a char *, which has a different size.

For instance, contrast:

#define FOO "ABC"
sizeof(FOO);

to:

static const char *FOO = "ABC";
sizeof(FOO);