Article View: be.comp.programming
Article #17474Re: ANSI opties voor GCC compiler.
From: SledgeHam
Date: Sun, 19 Dec 1999 00:00
Date: Sun, 19 Dec 1999 00:00
100 lines
4368 bytes
4368 bytes
In article <83isrt$2rl$1@news0.skynet.be>, Andy Peeters wrote:
>Hi,
>
>Ik wens een zelfgeschreven C programma te compileren met GCC.
>Kan iemand mij vertellen welke opties ik aan GCC moet meegeven
>zodat de source wordt gecontroleerd volgens de ANSI C standaard.
>(met ook de juiste warnings.)
de man-peetsj zegt:
-ansi Support all ANSI standard C programs.
This turns off certain features of GNU C that are
incompatible with ANSI C, such as the asm, inline
and typeof keywords, and predefined macros such as
unix and vax that identify the type of system you
are using. It also enables the undesirable and
rarely used ANSI trigraph feature, and disallows
`$' as part of identifiers.
The alternate keywords __asm__, __extension__,
__inline__ and __typeof__ continue to work despite
`-ansi'. You would not want to use them in an ANSI
C program, of course, but it is useful to put them
in header files that might be included in compila-
tions done with `-ansi'. Alternate predefined
macros such as __unix__ and __vax__ are also avail-
able, with or without `-ansi'.
The `-ansi' option does not cause non-ANSI programs
to be rejected gratuitously. For that, `-pedantic'
is required in addition to `-ansi'.
The preprocessor predefines a macro __STRICT_ANSI__
when you use the `-ansi' option. Some header files
may notice this macro and refrain from declaring
certain functions or defining certain macros that
the ANSI standard doesn't call for; this is to
avoid interfering with any programs that might use
these names for other things.
Dus als je enkel ansi C wil, dan moet je -ansi gebruiken (dan worden
bepaalde gcc extensies uitgeschakeld) en -pedantic (dan krijg je dit
ook als warning te zien) of zelf -pedantic-errors (dan wordt je
programma gewoonweg niet gecompileerd):
-pedantic
Issue all the warnings demanded by strict ANSI
standard C; reject all programs that use forbidden
extensions.
Valid ANSI standard C programs should compile prop-
GNU Tools 1993/10/13 16
GCC(1) GNU Tools GCC(1)
erly with or without this option (though a rare few
will require `-ansi'). However, without this op-
tion, certain GNU extensions and traditional C fea-
tures are supported as well. With this option,
they are rejected. There is no reason to use this
option; it exists only to satisfy pedants.
`-pedantic' does not cause warning messages for use
of the alternate keywords whose names begin and end
with `__'. Pedantic warnings are also disabled in
the expression that follows __extension__. Howev-
er, only system header files should use these es-
cape routes; application programs should avoid
them.
-pedantic-errors
Like `-pedantic', except that errors are produced
rather than warnings.
...
Hopelijk helpt dit,
SledgeHam,
>
>Dank u,
>Andy.
>
>
--
Remove .is.the.coolest to mail me
Technical Details
Message-ID:
<slrn85q65k.gb4.SledgeHam.is.the.coolest@olympus.mgmt>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<83isrt$2rl$1@news0.skynet.be>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fcea4,ec04ddfb229c05fa X-Google-Attributes: gidfcea4,public From: SledgeHam.is.the.coolest@pandora.be (SledgeHam) Subject: Re: ANSI opties voor GCC compiler. Date: 1999/12/19 Message-ID: <slrn85q65k.gb4.SledgeHam.is.the.coolest@olympus.mgmt> X-Deja-AN: 562687465 References: <83isrt$2rl$1@news0.skynet.be> X-Complaints-To: abuse@pandora.be X-Trace: afrodite.telenet-ops.be 945625268 192.168.252.1 (Sun, 19 Dec 1999 18:41:08 MET) Organization: Pandora-- Met vlotte tred op Internet User-Agent: slrn/0.9.5.7 (UNIX) NNTP-Posting-Date: Sun, 19 Dec 1999 18:41:08 MET Newsgroups: be.comp.programming