This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Strange pedantic error message


gcc is not the only free C compiler.
It is not even the fastest free C compiler!

*Usually*, it is a good idea to get gcc to tell you when you are using
features of gcc that are not portable.  This is usually a good idea
because people who do not use that option often use minor gcc extensions
(arithmetic on `void *', casts as lvalues, etc.) without even
realizing it.  It is of course quite reasonable in some circumstances
to explicitly decide to program in GNU C rather than portable C.
However, unless you have a particular need to for some GNU extension,
then it is better to stick to standard C rather than accidentally
using the minor extensions.

Why?  One reason is because you never know when someone will want to
reuse your code with another C compiler.  Why would they want to do
that?  Well, maybe they want faster compilation time, or maybe they
want some other feature that the other C compiler does better.
Generally it is better to keep your options open.  If you fix the
issues pointed out by `-pedantic' when you're writing the code, it
will be much much easier than if someone comes along and fixes them
afterwards.

Another reason to stick to standard C is that standard C tends to be
more a bit more stable.  GNU C features sometimes go away (e.g. the
C++ signature extension), change (e.g. GNU C features such as inline
that conflict with C99), or stop working properly and don't get
maintained (e.g. GNU C global register variables).  Of course standard
C features sometimes go away too (e.g. implicit int), but the
transition path tends to be longer and easier.

-- 
Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]