www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/05/15/04:04:12

To: djgpp AT sun DOT soe DOT clarkson DOT edu
From: antony AT werple DOT mira DOT net DOT au (Antony Suter)
Subject: Re: variable amount of arguments to function
Date: Mon, 15 May 1995 13:23:15 -0400
Reply-To: antony AT werple DOT mira DOT net DOT au
Lines: 18

>  S DOT B DOT M DOT Verstege AT research DOT ptt DOT nl (Stefan Verstege) wrote:-
>> I have written a function that must accept [a] variable [amount of]
[snip]
>
>  On PC djgpp (not necessarily on other computers) it works like this:-
>/*-----*/
>int myfunction(int nargs,...){long int*p = (long int*)&nargs;
>
>/* The array p now contains all the arguments. p[0] = nargs. The rest of the
>arguments are in order left to right in the array p, each taking up as many

You should really use the va_start(), va_args(), etc. macros defined in
ANSI C, and in GCC's header files.

--
- Antony Suter  <antony AT werple DOT mira DOT net DOT au>
- (Rohaan)      <s871780 AT minyos DOT xx DOT rmit DOT edu DOT au>
- "In space, all warriors are Code warriors", Chang, ST6

- Raw text -


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