__STDC__ a strncmp()

Jan Kasprzak kas na informatics.muni.cz
Pondělí Únor 14 11:44:11 CET 2000


Cejka Rudolf wrote:
: Jan Kasprzak <kas na informatics.muni.cz> wrote:
: > 	nevite nekdo, jaka makra musi uzivatel definovat, pokud pozaduje
: > prostredi kompatibilni s POSIXem? Napriklad na Linuxu pri
: 
: Pro POSIX je _POSIX_SOURCE (verze je v _POSIX_C_SOURCE).
: Pro XOPEN je _XOPEN_SOURCE (verze je v _XOPEN_VERSION).
: 
	Grepovanim hlavickovych souboru jsem nasel (a doporucuji ke cteni)
/usr/include/features.h (patri do baliku glibc, na jinych systemech
ho asi nenajdete). Obsahuje rozumne vysvetleni, co muzete od
ruznych systemu cekat.

: /* These are defined by the user (or the compiler)
:    to specify the desired environment:
: 
:    __STRICT_ANSI__      ISO Standard C.
:    _ISOC9X_SOURCE       Extensions to ISO C 89 from ISO C 9x.
:    _POSIX_SOURCE        IEEE Std 1003.1.
:    _POSIX_C_SOURCE      If ==1, like _POSIX_SOURCE; if >=2 add IEEE Std 1003.2;
:                         if >=199309L, add IEEE Std 1003.1b-1993;
:                         if >=199506L, add IEEE Std 1003.1c-1995
:    _XOPEN_SOURCE        Includes POSIX and XPG things.  Set to 500 if
:                         Single Unix conformance is wanted.
:    _XOPEN_SOURCE_EXTENDED XPG things and X/Open Unix extensions.
:    _LARGEFILE_SOURCE    Some more functions for correct standard I/O.
:    _LARGEFILE64_SOURCE  Additional functionality from LFS for large files.
:    _FILE_OFFSET_BITS=N  Select default filesystem interface.
:    _BSD_SOURCE          ISO C, POSIX, and 4.3BSD things.
:    _SVID_SOURCE         ISO C, POSIX, and SVID things.
:    _GNU_SOURCE          All of the above, plus GNU extensions.
:    _REENTRANT           Select additionally reentrant object.
:    _THREAD_SAFE         Same as _REENTRANT, often used by other systems.
: 
:    The `-ansi' switch to the GNU C compiler defines __STRICT_ANSI__.
:    If none of these are defined, the default is all but _GNU_SOURCE.
:    If more than one of these are defined, they accumulate.
:    For example __STRICT_ANSI__, _POSIX_SOURCE and _POSIX_C_SOURCE
:    together give you ISO C, 1003.1, and 1003.2, but nothing else.

	Takze pokud chcete treba snprintf(), je nutno dat
_ISOC9X_SOURCE.

-Yenya

-- 
\ Jan "Yenya" Kasprzak <kas at fi.muni.cz>       http://www.fi.muni.cz/~kas/
\\ PGP: finger kas at aisa.fi.muni.cz   0D99A7FB206605D7 8B35FCDE05B18A5E //
\\\             Czech Linux Homepage:  http://www.linux.cz/              ///
 Its purely bandwidth.  If it was 40 instances of Miguel reading web pages
flat out over 100baseT you would definitely be right. But its not...  (Alan)


Další informace o konferenci Linux