Errors in TDPL

Walter Bright newshound2 at digitalmars.com
Tue Jun 22 01:54:27 PDT 2010


Andrei Alexandrescu wrote:
> On 06/21/2010 08:47 PM, Jonathan M Davis wrote:
>> On page 82 of TDPL, it's talking about try/catch/finally statements, 
>> and it
>> says that "all controlled statement must be block statements; that is 
>> they
>> must be enclosed with braces." However, dmd does not seem to require that
>> try/catch/finally blocks have braces, which is what I would expect that
>> sentence to mean. C++ has that restriction for reasons that I don't
>> understand, but as far as I can tell, D does not - certainly dmd doesn't
>> appear to require it. Is the statement correct but refers to something 
>> else,
>> or is it in error?
>>
>> - Jonathan M Davis
> 
> That's a surprise to me. Walter, is that intentional?

They do not require braces, they just require that the controlling statement not 
be a single ;. In the grammar, this is a ScopeStatement, which is a 
NonEmptyStatement or a BlockStatement.


http://www.digitalmars.com/d/2.0/statement.html#ScopeStatement


More information about the Digitalmars-d mailing list