Re: [OFF TOPIC] was: Segfault in free()...C++
On Sep 5, 1997, at 10:16, E.L. Meijer \(Eric\) wrote:
> > Well, "remarks" are just that: comments the compiler has regarding
> > some non-standard, perhaps non-portable and not-so-secure assumptions
> > you MAY have made in your code.
> You didn't look carefully enough, or you don't understand what is
> there. These warnings are about a header file that ships with the
> compiler, not about my code! I usually want my code to compile cleanly
> at the highest warning level. It becomes very hard to check if there
> are any warnings in my code if the compiler reports loads of drivel in
> its system headers. Besides that things like `implicit conversion from
> long to int' are not necessarily harmless.
I did look, and I think I do understand... The highest warning level
in Irix is rather useless; almost all of the remarks it prints are
absolutely safe to ignore. They are not WARNINGS; they are
REMARKS. And yes, the system header files are choke full of remarks;
that is why that warning level is useless to begin with...
Of course, it would be nice if SGI got their act together and cleaned
up all of their headers so that you wouldn't see any of these
messages. But let me give you one example that made me forget about
using remarks with my code. This code snippet:
10: int foo()
12: Bar bar;
13: return 0;
generates a remark on line 12, stating that variable 'bar' was created
and never referenced. Well, there is a very typical idiom in C++ where
the constructor acquires resources (say, you grab a mutex) and the
destructor releases them. A remark here is totally bogus. And you get
hundreds of these! (At least we do in our code).
> > Nothing more, nothing less. They can
> > be safely ignored for the greatest part.
> `Safely ignoring' warnings is the ultimate route to creating software
> that will be hard to maintain and difficult to port, IMHO.
I think the 'warning' level from the compiler is good enough to spot
any real problems; the 'remark' level is where they put all these
additional checks that, in my experience, are useless and sometimes
plain wrong. If you feel more comfortable wading through all of the
remarks, just go ahead. YMMV.
> Eric Meijer
Gonzalo A. Diethelm G.
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
Trouble? e-mail to email@example.com .