This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Proposal for extension to GCC


On Aug 19, 2000, Ted Clancy <clancyt@look.ca> wrote:

> To clarify:
> 	B b(A(), A()); // Could mean construct two temporary A objects, 
> 			// and pass them to the constructor for B
> 			// (which is probably the intended meaning).
>  			// Actually means "declare a function returning B
>   			// and taking two arguments of class A".

No, taking two arguments of type (decayed pointer to) function
returning A.

Try to compile:

void f (int()) { f (1); }

> Try explaining to a novice about when they have to use parentheses
> or not.

Maybe C++ Coding Standards should mandate parentheses around
expressions, to make the disambiguation explicit.

> And some of those examples in the standard could confuse a
> moderately experienced C++ programmer.

Indeed :-) :-)

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]