Go to the previous, next section.
Many GNU facilities that already exist support a number of convenient extensions over the comparable Unix facilities. Whether to use these extensions in implementing your program is a difficult question.
On the one hand, using the extensions can make a cleaner program. On the other hand, people will not be able to build the program unless the other GNU tools are available. This might cause the program to work on fewer kinds of machines.
With some extensions, it might be easy to provide both alternatives.
For example, you can define functions with a "keyword" INLINE
and define that as a macro to expand into either inline
or
nothing, depending on the compiler.
In general, perhaps it is best not to use the extensions if you can straightforwardly do without them, but to use the extensions if they are a big improvement.
An exception to this rule are the large, established programs (such as Emacs) which run on a great variety of systems. Such programs would be broken by use of GNU extensions.
Another exception is for programs that are used as part of compilation: anything that must be compiled with other compilers in order to bootstrap the GNU compilation facilities. If these require the GNU compiler, then no one can compile them without having them installed already. That would be no good.
Since most computer systems do not yet implement ANSI C, using the ANSI C features is effectively using a GNU extension, so the same considerations apply. (Except for ANSI features that we discourage, such as trigraphs--don't ever use them.)
Go to the previous, next section.