> 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).
Nope. Calling a function without a prototype is precisely equivalent to
K&R rules. If a function will be called in such "K&R style", and the
function prototype and/or definition have any non-promoted parameters, the
result is undefined. For example
void foo(short p1) { .... }
is *ILLEGAL* if foo will ever be called without a prototype in scope; p1
must be an int.
> 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).
Once K&R is included, the situation becomes a lot less clear. Also, as I
read the thread on the GCC list, it looks like the situation is further
complicated by their desire to avoid an internal compiler error. Also**2,
I don't know what you mean by C's aliasing rules; to me that brings to
mind the ill-conceived 'noalias' qualifier.
If this is worth further discussion, a concrete example (code fragment)
would help me a lot.
/r$
--
STSM, Senior Security Architect
SOA Appliances
Application Integration Middleware
______________________________________________________________________
OpenSSL Project http://www.openssl.org
Development Mailing List [email protected]
Automated List Manager [EMAIL PROTECTED]