Re: Strange - a simple assignment statement shows error in VC++ but
works in gcc !
On 8 Apr., 18:22, Keith Thompson <ks...@mib.org> wrote:
peter koch <peter.koch.lar...@gmail.com> writes:
On 8 Apr., 00:48, Keith Thompson <ks...@mib.org> wrote:
[snip]
(I'm assuming you really meant "conversions", not "casts".)
Very nice one, but I kind of doubt that last statement. I naturally
meant explicit conversion, in C: cast.
Ok, then most of what I wrote (and snipped in this followup) is
irrelevant -- and David Schwartz failed in his attempt to read your
mind 8-)}.
Okay, I believed your entire post to be an attempted joke ;-)
Please note that this thread is cross-posted to comp.lang.c, which
is where I'm reading it. We try to distinguish very clearly between
casts (i.e., uses of the cast operator, a parenthesized type name
which precedes an expression) and conversions (which may be either
explicit, via a cast operator, or implicit).
I did notice the crosspost and as already explained, my intention was
to use the word "cast". A non-freudian slip, most likely.
(Note that "explicit
cast" is redundant, and "implicit cast" is a contradiction -- not
that you used either phrase.) So when you said that all conversions
should be accompanied by a comment, I naturally assumed you meant
*all* conversions, including implicit ones.
Yes, a coding standard that requires a comment (presumably a
non-trivial one) for each cast is an interesting idea. Casts should,
IMHO, be rare enough that this isn't a burden.
Exactly. I heard about 1500 casts in a 450000 line program and the
ratio struck me as rather high. But since I changed from C to C++
around 1996 and as I remember writing far more casts as a C-programmer
than as a C++ programmer, I decided not to comment those statistics.
Even then, this amount of comments should not be to big a burden.
/Peter