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 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-26 06:20:48 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!elnk-pas-nf1!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!stamper.news.atl.earthlink.net!newsread1.news.atl.earthlink.net.POSTED!d9c68f36!not-for-mail Message-ID: <3FEC43B2.5080606@noplace.com> From: Marin David Condic User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.0.1) Gecko/20020823 Netscape/7.0 (OEM-HPQ-PRS1C03) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: GNAT parameter passing, C-style? References: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 26 Dec 2003 14:20:47 GMT NNTP-Posting-Host: 209.165.23.157 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.news.atl.earthlink.net 1072448447 209.165.23.157 (Fri, 26 Dec 2003 06:20:47 PST) NNTP-Posting-Date: Fri, 26 Dec 2003 06:20:47 PST Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: archiver1.google.com comp.lang.ada:3811 Date: 2003-12-26T14:20:47+00:00 List-Id: You're talking about the ordering of parameters as they are pushed on the stack? I know of no mechanism to control that in the Ada standard and I doubt that the standard could possibly specify anything that is such a low level implementation detail. What about machines with large register sets? Compilers would want to optimize by putting parameters in registers and that might mess up the order you think you're getting. Different platforms will have different parameter passing mechanisms and conventions. What you refer to as "C-Style" and "Pascal-Style" is probably misleading as well. What C compiler on what platform? Likewise for Pascal? AFAIK, there is no requirement in C or Pascal to use any particular mechanisms for parameter passing (beyond C allowing you to specify that something should live in a register.) If you had two different compiler writers working on two different platforms, you'd likely get two different mechanisms for parameter passing. Should the stack pointer increment or decrement as it puts items on the stack? It depends - what's the convention on the processor, OS, other-compilers-you-wish-to-be-compatible-with combinations? Does the machine even have a stack pointer? If there is any such thing as an Ada mechanism, it would be through the pragmas for interfacing to other languages. Indicating that you are calling (or being called from) a C program should try to enforce C conventions. But there is no one, single "C-Style" anyway, so you'd have to know if your Ada compiler lined up with a particular C compiler. With Gnat, it is both an Ada and a C compiler, so it is likely to be consistent with itself. But Gnat couldn't promise you compatibility with someone else's C compiler. MDC Luke A. Guest wrote: > Hi, > > I've just written a program to prove it, but am I correct in saying that > the GNAT procedure/function calling mechanism is to pass parameters from > right-to-left (C-style), rather than left-to-right (PASCAL-style)? > > I was also wondering if there is an Ada standard way to changing the > mechanism? Or this compiler specific? > > Thanks, > Luke. > -- ====================================================================== Marin David Condic I work for: http://www.belcan.com/ My project is: http://www.jsf.mil/NSFrames.htm Send Replies To: m o d c @ a m o g c n i c . r "Face it ladies, its not the dress that makes you look fat. Its the FAT that makes you look fat." -- Al Bundy ======================================================================