From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23163 invoked by alias); 23 Apr 2004 07:38:34 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 23138 invoked from network); 23 Apr 2004 07:38:31 -0000 Received: from unknown (HELO smtp.cegetel.net) (212.94.174.78) by sources.redhat.com with SMTP; 23 Apr 2004 07:38:31 -0000 Received: from nostromo (unknown [213.223.207.31]) by smtp.cegetel.net (Postfix) with ESMTP id A732957683; Fri, 23 Apr 2004 09:38:29 +0200 (CEST) Received: from amavis by nostromo with scanned-ok (Exim 3.35 #1 (Debian)) id 1BGvL5-00062x-00; Fri, 23 Apr 2004 09:43:11 +0200 Received: from nostromo ([127.0.0.1]) by localhost (nostromo [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 22225-08; Fri, 23 Apr 2004 09:43:11 +0200 (CEST) Received: from [192.168.0.131] (helo=open-plug.com) by nostromo with esmtp (Exim 3.35 #1 (Debian)) id 1BGvL3-00062k-00; Fri, 23 Apr 2004 09:43:09 +0200 Message-ID: <4088C829.6000307@open-plug.com> Date: Fri, 23 Apr 2004 07:38:00 -0000 From: Cezar Harabula User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040113 MIME-Version: 1.0 To: Eljay Love-Jensen Cc: gcc-help@gcc.gnu.org, gcc-help-info@gcc.gnu.org Subject: Re: C calling conventions: how to pass a struct parameter? References: <4087FAC0.5050502@open-plug.com> <6.0.3.0.2.20040422125050.01f9df58@iplan-mn.corp.adobe.com> In-Reply-To: <6.0.3.0.2.20040422125050.01f9df58@iplan-mn.corp.adobe.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new-20030616-p7 (Debian) at open-plug.com X-SW-Source: 2004-04/txt/msg00307.txt.bz2 Thank you for your answers. Unfortunately, I was not clear enough. I want to know what happens in the registers and in the stack when a procedure like void PrintFoo(struct Foo foo) is called. There is no universal C calling convention set for x86, so I am interested in how GCC usually does. What about a struct return value: struct bar Function() ? Thanks. Cezar Eljay Love-Jensen wrote: > Hi Cezar, > > (Hey, "Cezar", cool name.) > > This should work: > > struct Foo { int a,b,c; }; > > void PrintFoo(struct Foo foo) > { > printf("Foo:%d,%d,%d\n", foo.a, foo.b, foo.c); > } > > That's a pass-by-value. > > Here's pass-by-pointer: >