From: "Frank J. Lhota" <NOSPAM.lhota.adarose@verizon.net>
Subject: Re: GNAT parameter passing, C-style?
Date: Wed, 31 Dec 2003 16:30:17 GMT
Date: 2003-12-31T16:30:17+00:00 [thread overview]
Message-ID: <tQCIb.1395$x34.387@nwrdny02.gnilink.net> (raw)
In-Reply-To: 1072883131.278899@master.nyc.kbcfp.com
"Hyman Rosen" <hyrosen@mail.com> wrote in message
news:1072883131.278899@master.nyc.kbcfp.com...
> Frank J. Lhota wrote:
> The upshot is that even when calling a function without a prototype, the
> compiler may pass arguments any way it likes, and it is absolutely not
> required to "push" them onto a "stack" in any particular order.
It may not be required by the standard, but it is required to support legacy
code. Certainly any C code written after ANSI C became widely available
should use prototypes, but for many years there was plenty of maintained K&R
C code written like this:
extern int futz();
{
...
if ( futz( name, count ) ) ...
}
where there is no indication as to whether or not the function takes a
variable argument list. You can argue all you want that a compiler is not
required to generate correct code for such a program, but the sheer weight
of legacy code forces the compiler manufactures to not break code like this.
I go back to my original question: does anyone know of a C compiler which,
when compiling C (not C++) does not default to the C calling convention
(i.e. arguments pushed on the stack in reverse order, and popped off by
calling function) in the absence of any indication of another convention?
The two C compilers I am currently using (GCC version 3.3.1, MSVC Version 6)
both default to the C convention. I recall that every Borland compiler up to
4.0 defaulted to the C convention as well, as did the early Zortech /
Symantec compilers.
Again, I am not saying this out of fondness for the C calling convention.
The original K&R specification, unfortunately, forced the undesirable use of
this convention for many years. The C++ people should be congraduated for
making a bold enough break from the past to eliminate almost all need for
this convention.
I should also note that this has never been an issue in Ada. (This is an Ada
newsgroup, after all).
next prev parent reply other threads:[~2003-12-31 16:30 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-12-26 10:37 GNAT parameter passing, C-style? Luke A. Guest
2003-12-26 14:20 ` Marin David Condic
2003-12-26 14:51 ` Hyman Rosen
2003-12-26 15:07 ` Marin David Condic
2003-12-26 15:39 ` Luke A. Guest
2003-12-26 17:03 ` Hyman Rosen
2003-12-26 17:08 ` Luke A. Guest
2003-12-26 17:27 ` Luke A. Guest
2003-12-26 18:21 ` Frank J. Lhota
2003-12-26 19:06 ` Frank J. Lhota
2003-12-31 10:23 ` Keith Thompson
2003-12-31 14:45 ` Frank J. Lhota
2003-12-31 15:05 ` Hyman Rosen
2003-12-31 16:30 ` Frank J. Lhota [this message]
2003-12-31 17:24 ` Hyman Rosen
2003-12-31 19:05 ` Frank J. Lhota
2003-12-31 19:38 ` Hyman Rosen
2003-12-31 20:47 ` Frank J. Lhota
2003-12-31 21:35 ` Hyman Rosen
2004-01-01 2:50 ` Frank J. Lhota
2004-01-01 5:20 ` Luke A. Guest
2004-01-01 16:06 ` Hyman Rosen
2004-01-01 16:32 ` Frank J. Lhota
2004-01-01 16:43 ` Hyman Rosen
2004-01-02 0:24 ` Frank J. Lhota
2004-01-02 4:09 ` Hyman Rosen
2004-01-02 13:29 ` Frank J. Lhota
2004-01-01 5:17 ` Luke A. Guest
2004-01-01 5:09 ` Luke A. Guest
2004-01-02 1:17 ` tmoran
2004-01-01 17:18 ` Jano
2004-01-02 0:25 ` Frank J. Lhota
2004-01-07 6:37 ` Dave Thompson
2004-01-01 3:38 ` Marin David Condic
2004-01-01 5:28 ` Luke A. Guest
2004-01-01 14:17 ` Marin David Condic
2004-01-01 16:20 ` Jeff C,
2004-01-02 13:47 ` Marin David Condic
2004-01-05 21:06 ` Keith Thompson
2004-01-06 3:42 ` Robert I. Eachus
2004-01-06 20:54 ` Keith Thompson
2004-01-06 23:45 ` Robert I. Eachus
2004-01-06 13:46 ` Frank J. Lhota
2003-12-27 14:22 ` Marin David Condic
2003-12-26 17:10 ` Martin Krischik
2003-12-26 19:04 ` Frank J. Lhota
2003-12-26 18:01 ` Georg Bauhaus
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox