This is a discussion on RE: OpenSSL breaks with gcc 4.2 - Openssl ; > > davids> simple -- if you are going to call a function whose types you > > davids> don't know (through a prototype), you must cast each type you > > davids> pass to the type the function expects. ...
> > davids> simple -- if you are going to call a function whose types you
> > davids> don't know (through a prototype), you must cast each type you
> > davids> pass to the type the function expects. End of story. OpenSSL
> > davids> does not do this. This is not valid C whether or not the type
> > davids> sizes are the same.
> I don't think that's correct. If you are calling a function where a
> prototype is not in scope, the 'classic' promotion rules are used (float
> to double, char or short to int, etc).
Are you saying the call is legal even if the promotion rules do not result
in calling the function with the exact types it expects? That conflicts
massively with my understanding of the C language.
As I understood it, calling a function without a prototype was precisely
equivalent to declaring a prototype of the function with the exact parameter
types passed (after promotion rules).
Calling a function with the wrong pointer type *will* break in the face of
optimization. That is why GCC 4.2 breaks when it tries to inline such
function calls. Even if it wasn't a violation of C's function type rules,
which I think it is, it's also a violation of C's aliasing rules (when the
types are pointers).
OpenSSL Project http://www.openssl.org
Development Mailing List email@example.com
Automated List Manager firstname.lastname@example.org