R
roberts.noah
Alf said:Besides being ugly, of no technical consequence and thus misleading, and
more to read and write, it's a C'ism, and so a second reason for not
using it is the general one of avoiding C'isms. For the habit of coding
C style in C++ can have adverse consequences. And the more C'isms are
used, the easier it is to slip into a C mindset.
It seems like a really minor issue to me. Reading/writing more is an
argument I often hear against C++ casting. IMHO that argument stems
just from lazyness and has no technical merrit. About it being
confusing I don't think so; there is nothing in (void) that is
confusing; its meaning is rather obvious. Uglyness is a point of
preference and so technically an invalid argument. So really the only
thing against it is that it is meaningless.
The C'isms argument has some small amount of validity, and is the only
way you used to show harm, but I don't believe it is as aweful as you
are asserting...you aren't going to "slip into the C mindset" because
you use (void) in your function declarations and definitions. In all
honesty though the whole () thing isn't used much in C anymore anyway,
because it is horrible, and people often, wrongly, interchange the
meaning of the two. In other words as a "C'ism" it is a pretty weak
one.
In all honesty I was expecting a bit more to back something as
assertive as "abomination". I also think you are misinterpreting the
quote, which is stating that () in C is an abomination, not that (void)
is; the *necessity* for void in a parameter list is what is wrong with
C. I would tend to agree with that statement for the same reason why
someone might put void in their parameter list to assert that this
function can have no parameters...leaving no room for doubt.
Another reason might be that () doesn't look as nice as (void).