From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23226 invoked by alias); 27 Nov 2006 14:23:57 -0000 Received: (qmail 23147 invoked by uid 22791); 27 Nov 2006 14:23:54 -0000 X-Spam-Check-By: sourceware.org Received: from exprod6og55.obsmtp.com (HELO exprod6og55.obsmtp.com) (64.18.1.191) by sourceware.org (qpsmtpd/0.31) with SMTP; Mon, 27 Nov 2006 14:23:42 +0000 Received: from source ([192.150.20.142]) by exprod6ob55.postini.com ([64.18.5.12]) with SMTP; Mon, 27 Nov 2006 06:23:39 PST Received: from inner-relay-3.eur.adobe.com (inner-relay-3b [10.128.4.236]) by outbound-smtp-2.corp.adobe.com (8.12.10/8.12.10) with ESMTP id kARENsIY009183; Mon, 27 Nov 2006 06:23:54 -0800 (PST) Received: from fe2.corp.adobe.com (fe2.corp.adobe.com [10.8.192.72]) by inner-relay-3.eur.adobe.com (8.12.10/8.12.9) with ESMTP id kAREMueE009636; Mon, 27 Nov 2006 06:23:33 -0800 (PST) Received: from namailgen.corp.adobe.com ([10.8.192.91]) by fe2.corp.adobe.com with Microsoft SMTPSVC(6.0.3790.1830); Mon, 27 Nov 2006 06:23:30 -0800 Received: from 10.32.16.88 ([10.32.16.88]) by namailgen.corp.adobe.com ([10.8.192.91]) via Exchange Front-End Server namailhost.corp.adobe.com ([10.8.192.72]) with Microsoft Exchange Server HTTP-DAV ; Mon, 27 Nov 2006 14:23:29 +0000 User-Agent: Microsoft-Entourage/11.2.5.060620 Date: Mon, 27 Nov 2006 14:23:00 -0000 Subject: Re: problem with solaris compiler From: John Love-Jensen To: Priya Sinha , MSX to GCC Message-ID: In-Reply-To: Mime-version: 1.0 Content-type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2006-11/txt/msg00318.txt.bz2 Hi Priya, > why does a compiler push the arguments from left to right or right to > left in a function call (especially with respect to gcc)? GCC uses the calling convention that is appropriate for the platform. There are several (many?) different calling conventions, of which GCC supports a variety of them. A calling convention covers these kinds of things: + what order are the arguments pushed on the stack... + ...or are arguments passed in by registers + who is responsible for popping the arguments + how is the name decorated Some calling conventions are particular to a given language or operating system, hence people might refer to "the Pascal calling convention", or "the Windows calling convention", or the "SPARC ABI". GCC uses the calling convention that is appropriate for the platform (operating system + language). Sometimes you need finer control over the calling convention used, rather than use the default -- that's where the __attribute__ facilities come into play. Here's the GCC online documentation on the topic (the information is scattered throughout the HTML page): http://gcc.gnu.org/onlinedocs/gcc-4.1.1/gcc/Function-Attributes.html HTH, --Eljay