3.6% of heads up: Please correct your #includes or optflags use

Horst H. von Brand vonbrand at inf.utfsm.cl
Tue Mar 25 17:50:51 UTC 2008


Hans de Goede <j.w.r.degoede at hhs.nl> wrote:
> Patrice Dumas wrote:
> > On Mon, Mar 24, 2008 at 07:11:27PM +0100, Hans de Goede wrote:
> >> Yes fixing them is important, missing prototypes can lead to all
> >> sort of errors and often lead to 64 bit issues (== crashes).
> > And more specifically? What kid of 64bit issues and for which
> > function?
> > For that example, I don't mind fixing dome missing prototypes, but all
> > is certainly a waste of my time.
> >
> 
> Anything (any function) that returns a pointer, will be a problem when
> compiled on 64 bit without a prototype, as the compiler will assume
> the return type is an int, and then cast that to a pointer as needed.
> 
> Anything returning a float / double will be a problem regardless of
> 32/64 bits as only 32 bits of the returned floating point number will
> be taken and interpreted as an int (and then cast back to a float /
> double if used as such).

Nope, on i386 doubles are returned in the floating point registers, ints
are returned in EAX. You just get whatever garbage was left over in "the
other one".

> Any function called with arguments of different type then expected
> (for example a float, where the function expects an int or visa versa)
> will have the same problem.

Yep. The "default promotion rules" of C kick in.n
-- 
Dr. Horst H. von Brand                   User #22616 counter.li.org
Departamento de Informatica                    Fono: +56 32 2654431
Universidad Tecnica Federico Santa Maria             +56 32 2654239
Casilla 110-V, Valparaiso, Chile               Fax:  +56 32 2797513




More information about the devel mailing list