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 Fri, 18 Aug 2000, Alexandre Oliva wrote:

> > 1) First of all, C++ is NOT YACCable.
> 
> Indeed.  But since we must support the Standard syntax, it won't
> become YACCable just because of your proposal.

I'm well aware of that, and I wasn't suggesting anything to the contrary. In
fact, I even said: "Unfortunately, we can't change C++'s history,
and we have to live with it." (Re-read my post and you'll see.)

What I would like is if it was possible for people, if they chose, to write in
a YACCable version of C++. This is of interest to me because I'm writing a C++
parser/editor tool, but it should be of interest to anyone who's using
YACC-based tools (such as GCC)

> > And just change
> > 	B b(A(), A());
> > to 
> > 	B b(A, A);  //explicitly made a function declaration.
> 
> But a different one :-)
> 
> Or maybe you meant:
> 
> B b(A (*)(), A (*)());
> 

No, you've misinterpreted me. I meant for A to be the name of a class, not a
function (which appears to be how you interpreted it). My apologies for the
ambiguity. 

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".

	B b(A, A)	// Explicitly means "declare a function returning B
			// and taking two arguments of class A".

> > It's much harder to specifiy that you want the ambiguous token 
> > sequence to be an expression. 
> 
> Indeed.  You have to enclose the ambiguous expressions in parentheses:
> 
> B b((A()), (A()));
> (int(*a)), b, c;
> (int(*a), b, c);

Try explaining to a novice about when they have to use parentheses or not. And
some of those examples in the standard could confuse a moderately
experienced C++ programmer.

Anyway, I've already acknowledged the program with my proposed syntax in an
earlier email to the list, but it would still be nice to have an alternative
syntax, especially if it fit well with C99's (struct X){..., ..., ...} syntax
for anonymous objects.

Ted Clancy.

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