www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1998/06/16/06:24:02

Date: Tue, 16 Jun 1998 13:22:09 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Vik Heyndrickx <Vik DOT Heyndrickx AT rug DOT ac DOT be>
cc: Charles Marslett <charles DOT marslett AT vlsi DOT com>, DJ Delorie <dj AT delorie DOT com>,
nate AT cartsys DOT com, djgpp-workers AT delorie DOT com
Subject: Re: inb/outb
In-Reply-To: <35862AD6.7C5D@rug.ac.be>
Message-ID: <Pine.SUN.3.91.980616131844.13693C-100000@is>
MIME-Version: 1.0

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019