I think I should be clearer.

If class Bar has one ore more non default copy constructor, that happens. Otherwise gcc passes object to callee, using default copy constructor


-----Original Message-----
From: mingw-users-admin@lists.sourceforge.net [mailto:mingw-users-admin@lists.sourceforge.net] On Behalf Of longchuan
星期五 2002 07 26 10:25
To: mingw-users@lists.sourceforge.net
Subject: [Mingw-users] struct or class as function parameter


Hello all:

       I followed assemble code, and found that in Gcc code, when pass a structure or class as parameter, say:

       void __stdcall Foo(class Bar bar):

1.        construct a bar obj on caller stack, using constructor or copy constructor, or something similar;

2.       fetch a pointer point to the stack object, using “lea “;

3.       push the pointer to callee stack as parameter.

4.       recover bar from pointer passed, using bar.xxx ;


My question is: As bar is not a pointer type, why gcc still pass the pointer as parameter (Sounded that this is the standard of ANSI C). I guess that in this way, passing parameters are in the uniform syntax, no matter it is a pointer or object. 

Could I change this default parameter passing rule? Sometimes I may like to passing object as object, not the extra pointer.