[NTLUG:Discuss] gcc 3.0.1

Richard Cobbe cobbe at airmail.net
Sat Sep 8 12:29:15 CDT 2001


Lo, on Saturday, September 8, Steve Baker did write:

> Ken Frazer wrote:
> > 
> > I understand that gcc 3.0 had some problems.  Is 3.0.1 worth installing, in
> > particular, should I replace 2.95.x with it?  Are there any caveats I
> > should be aware of if I do switch to 3.0.1?
> 
> It's a lot pickier about some trivial things - one that annoys me is that
> it complains if a file does not end with a newline!

Does it really?  That's moderately surprising.  I know a number of older
Unix tools tend to balk at such files, but I can't see why gcc would care.
A quick glance at the C++ spec suggests that this is not a formal
requirement, but at over 700 pages, I may well have missed something.

Oh, well; it's easy enough to fix:

(setq require-final-newline t)

> I think all the significant new messages are warnings - but I always go
> by the rule "Warnings are Errors too".

In general, I use that guideline as well.  It's somewhat annoying, however,
that gcc does not, to my knowledge, provide a mechanism to disable specific
warnings for certain locations in a program.  MSVC++ has something like
this; I don't remember the syntax exactly, but I think it's something along
the lines of 

#pragma disable 2423
...
#pragma enable 2423

where 2423 is the warning number that you can look up in their docs.  So,
for instance, you can say, ``yes, thanks, I know that comparing signed and
unsigned ints isn't valid in the general case, but I happen to know that
the signed int right here will never be negative, so shut up and let me do
it, please!''  Admittedly, this isn't a very good example, because you can
work around it with suitable typecasts, but you get the idea.

Does GCC 3 have anything like this?  I know the GCC folks don't like
pragmas much, but is there perhaps another mechanism which provides the
same basic functionality?

Richard



More information about the Discuss mailing list