delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1998/06/16/07:11:51

Sender: Vik DOT Heyndrickx AT rug DOT ac DOT be
Message-ID: <358652E8.20C2@rug.ac.be>
Date: Tue, 16 Jun 1998 13:11:36 +0200
From: Vik Heyndrickx <Vik DOT Heyndrickx AT rug DOT ac DOT be>
MIME-Version: 1.0
To: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
CC: Charles Marslett <charles DOT marslett AT vlsi DOT com>, djgpp-workers AT delorie DOT com
Subject: Re: inb/outb
References: <Pine DOT SUN DOT 3 DOT 91 DOT 980616131844 DOT 13693C-100000 AT is>

Eli Zaretskii wrote:
> > 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.

If ``it will work'' means that it will compile without errors or
warnings then you are right, but as a result of specifying the wrong
prototype -as coded inline in the source-, the arguments will end up in
the wrong order of the calling stack and as a result garbage is passed
to foo_XQ (in my interpretetation that means ``it won't work''), since
foo_XQ is a library function.

IMHO

-- 
 \ Vik /-_-_-_-_-_-_/
  \___/ Heyndrickx /
   \ /-_-_-_-_-_-_/  Knight in the Order of the Unsigned Types

- Raw text -


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