bug-indent
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

rehashing unary-op "regression" in 2.2.11


From: Mats Wichmann
Subject: rehashing unary-op "regression" in 2.2.11
Date: Mon, 30 Aug 2010 12:17:00 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.11) Gecko/20100720 Fedora/3.0.6-1.fc12 Thunderbird/3.0.6


Back in April I see there was a thread on new behavior which
didn't do the expected thing with !!

The argument at the time was:

"Indeed your described behaviour is a defined part of C, however I'd say
that such a usage falls under the category of 'cleverness' - where most
programmers would need to reach for the manual to verify what the result
would be and what the intention is. See for example what "Writing Solid
Code" - Steve Maguire has to say on the subject (basically "avoid
cleverness"). Since your expression is two applications of an operator
(and not a multi-character operator) I would say that in this regard
version 2.2.11 doesn't regress, but (unintentionally) fixes a
long-standing defect. "


However, there are other unary operators as well; in particular this
also affects the indirection operator '*', without "cleverness".

Now a sequence such as this example:

    struct dirent * * dp;

Is no longer collapsed to:

    struct dirent **dp;

While there is no breakage in this, I would argue that the latter form
is at the very least part of the K&R "style", as it's the only way
the construct appears there - and pretty much anywhere else,
anecdotally.

Yeah, it's been a while; I work on a system where some header files
are generated using database data and some scripts, and then
indent is used to put the result into a consistent style.

Had a little surprise when the build host got upgraded to a distro
using 2.2.11 and suddenly there were many lines of diff...

-- mats




reply via email to

[Prev in Thread] Current Thread [Next in Thread]