2 ms·
Sizeof(void) == 1 in gcc
- apaprocki 15y agoGCC just happens to not even print a warning about this (even with -Wall). That is pretty bad. The warning can be enabled by specifying -Wpointer-arith or by using -pedantic, though. (Warning: "invalid application of 'sizeof' to a void type") IBM's xlc compiler produces a warning and compiles the code and it also returns 1. (Warning: "1506-043 (W) The operand of the sizeof operator is not valid.") Oracle Studio compiler has the best approach and fails to compile. (Error: "cannot take sizeof void")
- mooism2 15y agoWhat does the standard say?