views:

94

answers:

2

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?

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

+1  A: 

According to this post the answer is no, there is no guarantee that even sizeof(int*) is the same as sizeof(double*).

Mark E
Can you give links to standards and its sections, which defines it?
osgx
+4  A: 

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.

Johannes Schaub - litb
Does standard states that pointers to different types are different and can have incompatible representation?
osgx
Yes, it says so, except for a few cases. See `6.2.5/27`
Johannes Schaub - litb
sorry, I have standard only in form of "The new C standard. An economic and Cultural Commentary". This book uses global numbering of lines. So, please, put here citation of 6.2.5/27
osgx
i can't cite it, it's too much. Please see yourself in the draft: http://www.open-std.org/jtc1/sc22/WG14/www/docs/n1256.pdf
Johannes Schaub - litb