sizeof(void*) and sizeof(function_type_ptr*) equality
sizeof(void*) and sizeof(function_type_ptr*) equality
Must sizeof(void*) and sizeof(function_type_ptr*) be equal? Is it required by C (C90, C99) standard?
开发者_JAVA技巧function_type_ptr is pointer to function.
This question is about standard requirements, not your own opinion. Please, give links, section numbers and quotations from standards
The answer is no.
6.2.6.1/2
: Except for bit-fields, objects are composed of contiguous sequences of one or more bytes, the number, order, and encoding of which are either explicitly specified or implementation-defined.
No such specification is done for function / void pointers.
According to this post the answer is no, there is no guarantee that even sizeof(int*)
is the same as sizeof(double*)
.
精彩评论