> > And what if sizeof (void (*)()) != sizeof (void *)? Think MS-DOS and all
> > those sick small/medium/large/huge memory models if you have to. I
> > realize it's a sick thought, but that's what the compiler complains
> > about and that's why "such a cast is not permitted by the standard."
> 
> In this particular case
     ^^^^ Do you mean DEC C, VMS or something?
> I think the compiler is worried about
> alignment issues.  Functions need to be aligned in a very specific
> way.
So as doubles, longs, integers, shorts (on most platforms). Alignment
requirement for functions aren't extraordinary. I don't have standard
either, but http://www.c9x.org/ used to have draft on-line which is
close enough for any practical purpose. Unfortununately their site looks
messed up right now, but I have a PDF copy at
http://fy.chalmers.se/~appro/c9x-draft.pdf till they get things
straighten out. Relevant quotes:

"7. A pointer to an object or incomplete type may be converted to a
pointer to a different object or incomplete type. If the resulting
pointer is not correctly aligned for the pointed-to type, the behavior
is undefined. Otherwise, when converted back again, the result shall
compare equal to the original pointer. When a pointer to an object is
converted to a pointer to a character type, the result points to the
lowest addressed byte of the object. Successive increments of the
result, up to the size of the object, yield pointers to the remaining
bytes of the object.

8. A pointer to a function of one type may be converted to a pointer to
a function of another type and back again; the result shall compare
equal to the original pointer. If a converted pointer is used to call a
function whose type is not compatible with the pointed-to type, the
behavior is undefined."

That's it.

Andy.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to