* Mike Smith:
I do. (Except, of course, that *EVERYBODY KNOWS* that the braces should
not be indented! ;-)
Well, I don't, or rather, didn't. I did it that way for a period, years
ago, and, even though I found it horrible before that and after that, I
managed to make it seem natural to myself. If anybody asked, and they
did, I just told them "Petzold does it that way", perhaps with an
explanation of how it more accurately represented the parsing level.
The final revelation which made me stop was that the style does not
support inline blocks, which in turn means it doesn't support the
important guideline
* in C++, declare variables close to their first usage, and limit
their scopes as much as practically possible.
E.g., the code
for( int i = 0; i < 100; ++i )
{
std::cout << "whatever\n";
{
double const x = f( i );
// Do things with x
}
{
double const y = f( i );
// Do things with y
}
}
becomes less than readable with the indented braces style,
for( int i = 0; i < 100; ++i )
{
std::cout << "whatever\n";
{
double const x = f( i );
// Do things with x
}
{
double const y = f( i );
// Do things with y
}
}
Not that this kind of thing occurs very often in practice, but it's the
principle.