D should disallow forward references

BCS none at anon.com
Wed Aug 26 18:05:48 PDT 2009


Hello Jarrett,

> On Wed, Aug 26, 2009 at 8:47 PM, Stewart Gordon<smjg_1998 at yahoo.com>
> wrote:
>> 
>> qwert * yuiop;
>> 
>> a declaration of yuiop as a pointer to a qwert, or an instruction to
>> multiply qwert by yuiop but do nothing with the result?
>> 
> It's grammatically ambiguous, but not semantically. No-op statements
> are illegal. Thus, it's perfectly fine to always parse this as a
> pointer decl, since the other possible parse tree is always
> semantically invalid.
> 

In C, not in C++ or D where operator overloading can come into effect.

also consider:

A*B=C;

where A*B might be an expression that defines assignment. (BTW gcc assumes 
A is a type and errors)





More information about the Digitalmars-d mailing list