From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ac02560f0af03a21 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-12-31 07:05:54 PST Path: archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!crtntx1-snh1.gtei.net!news.gtei.net!newsfeed1.easynews.com!easynews.com!easynews!news-feed01.roc.ny.frontiernet.net!nntp.frontiernet.net!uunet!dca.uu.net!ash.uu.net!spool.news.uu.net!not-for-mail Date: Wed, 31 Dec 2003 10:05:31 -0500 From: Hyman Rosen User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5) Gecko/20031013 Thunderbird/0.3 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: GNAT parameter passing, C-style? References: <3FEC43B2.5080606@noplace.com> <1072450300.440355@master.nyc.kbcfp.com> <3FEC4E89.2070804@noplace.com> <1072458199.346049@master.nyc.kbcfp.com> <3fec7c21$0$4764$61fed72c@news.rcn.com> <4iBIb.8173$qS3.498@nwrdny03.gnilink.net> In-Reply-To: <4iBIb.8173$qS3.498@nwrdny03.gnilink.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Organization: KBC Financial Products Message-ID: <1072883131.278899@master.nyc.kbcfp.com> Cache-Post-Path: master.nyc.kbcfp.com!unknown@nightcrawler.nyc.kbcfp.com X-Cache: nntpcache 3.0.1 (see http://www.nntpcache.org/) NNTP-Posting-Host: 204.253.250.10 X-Trace: 1072883131 11498 204.253.250.10 Xref: archiver1.google.com comp.lang.ada:3990 Date: 2003-12-31T10:05:31-05:00 List-Id: Frank J. Lhota wrote: > For that reason, C compilers have to assume the C calling convention, > unless the user indicates via declaration or command line options. No, this is false. The C Standard essentially says that when you call a function without a prototype, the compiler constructs one for you based on the parameters you are supplying in the call. If this constructed prototype is not compatible with the definition of the function, then the program has undefined behavior. (This is jokingly referred to as the Miranda rule: You are entitled to a prototype. If you do not supply one, one will be provided for you.) Functions with variable argument lists must be prototyped before they are called, or again the results are undefined. 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.