|[QUERY] C++ ambiguties -- is this right? firstname.lastname@example.org (1997-01-07)|
|From:||email@example.com (John Lilley)|
|Date:||7 Jan 1997 12:18:37 -0500|
|Organization:||Nerds for Hire, Inc.|
|Keywords:||C++, parse, question|
I have a question concering the dreaded declaration/expression
ambiguities in C++. This is how my C++ parser treats the cases
described below. Am I handling this right?
Context: this is in a code block where statements are parsed.
Assuming that declarations with no declaration-specifiers are allowed,
then I parse this:
g(int(x), int(y)), h(int(z), int(3));
as declaring g as a function, and h as a variable with (too many)
initializers. This bothers me -- since it is not valid to declare
variables with no declaration-specifiers, then should this
interpretation be rejected in favor of a comma-expression calling g()
g(int(x), int(y)), h(int(z), int(3)), 5;
I parse as a comma-expression calling g() and h() and finally yielding
I'm unclear as to the status of declarations with no
declaration-specifiers. Are they still allowed in the latest draft?
Even if they are disallowed, is this sort of stuff still a practical
consideration for C++ parser wishing to handle old-style function
Return to the
Search the comp.compilers archives again.