This is a discussion on Re: OpenSSL breaks with gcc 4.2 - Openssl ; Stephen Sprunk wrote: > Thus spake Peter Waltenberg >> x is still just a pointer to data - so it's the same length in any >> case, all >> pointers to lvalues are the same length in C. The only ...
Stephen Sprunk wrote:
> Thus spake Peter Waltenberg
>> x is still just a pointer to data - so it's the same length in any
>> case, all
>> pointers to lvalues are the same length in C. The only issue there is
>> whether it's aligned correctly - that's the programmers problem.
> It's not the only problem.
>> Mixing something like char *(*d2i)(), and char ** IS problematic, since
>> those aren't guaranteed to be the same length but as far as I can
>> remember OpenSSL doesn't do that.
>> d2i is a function (prototype is unknown)
>> but I've been told x is a pointer, &p is a pointer, len is long. There's
>> nothing indeterminate about the size of any of those.
> Incorrect. When the compiler encounters this statement, if there's no
> prototype for d2i() in scope, it is _required_ to act as if the
> prototype were:
> int d2i(int, int, int);
I believe this is incorrect. When there is no prototype in scope, I
believe the compiler is _required_ to act as though there is a prototype
that exactly matches the type and number of arguments in the function
call after applying the usual arithmetic promotions. (I believe the
intent was to preserve compatibility with old pre-prototype K&R code.
Assuming that all parameters are of type int would wreak havoc with old
OpenSSL Project http://www.openssl.org
Development Mailing List email@example.com
Automated List Manager firstname.lastname@example.org