WTF?
BCS
ao at pathlink.com
Fri Mar 14 21:38:21 PDT 2008
Reply to Jascha,
> BCS wrote:
>
>> I'm not objecting but...
>>
>> this compiles (1.026):
>>
>> import std.stdio; void main()
>> {
>> int j = 3;
>> for({ int i; if(j>2) i = 3; else i = 4; } i; i--)
>> {
>> writef("%d\n", i);
>> }
>> }
>
> the specs clearly allow this, since a NoScopeNonEmptyStatement may be
> a BlockStatement.
>
That's how I found it. I was looking up the empty productions in the other
two parts and notices the the second ';' was in the for production, but the
first was part of the sub rule and started hunting and noticed what you pointed
out. It just seemed strange enough to warrant comment. I don't have a problem
with it, but it sure looks odd. <g>
More information about the Digitalmars-d
mailing list