Mail Archives: djgpp-workers/1998/06/16/06:24:02
On Tue, 16 Jun 1998, Vik Heyndrickx wrote:
> Suppose you have in ***another file*** a call to this function but no
> prototype was given yet:
>
> double r = foo (7, 3);
>
> Since this 7 is an integral constant and no floating point constant it
> will occupy only #sizeof(unsigned) number of bytes on the stack while
> ``foo'' expects 8 bytes (a double). As a result it won't work.
It *will* work if you say "foo (7.0, 3)". If I understand Charles'
point, an existing prototype is an *incurable* problem (unless yo avoid
including the header which declares the function) while a non-existing
prototype is a problem you *can* cure.
> A function declared (and defined) in one file as:
> void *foo_XQ (void *, int);
>
> In another file (originally written for another platform, on which the
> function is declared ``void *foo_XQ (int,void *)'') it is assumed foo_XQ
> will be defined in DJGPP, but DJGPP provides no prototypes for it:
>
> void *p;
> void *r = foo_XQ (7, p);
Same here: add a prototype inside your source, or use explicit cast in
the call, and it *will* work.
- Raw text -