[antlr-interest] C++ puzzle

Martin Probst mail at martin-probst.com
Wed Jun 29 08:07:42 PDT 2005


Hi,

> I also find it confusing that _Alty is a type as well as the 
> name of a function and _Alval is a variable as well as the name 
> of a function!

There are no "real" functions in there.
"_Alty _Al = _Alty()" is a call to the default constructor of _Alty,
compare "mytype foo = mytype();", which is of course equivalent to
"mytype foo();"

The _Alval(_Al) in: 
>      _String_val(_Alty _Al = _Alty())
>           : _Alval(_Al)
... is only the standard C++ initializer syntax, just as in

class MyFoo {
  int bar;
  public MyFoo()
    : bar(3) 
  {
    ...
  }
}

That is btw in my opinion the reason why C++ as a language is really
horrible - people tend to write stuff in it that is completely
unrecognisable to anyone, even when not using macros.

Regards,
Martin



More information about the antlr-interest mailing list