head 1.5;
access;
symbols
pkgsrc-2013Q2:1.5.0.30
pkgsrc-2013Q2-base:1.5
pkgsrc-2012Q4:1.5.0.28
pkgsrc-2012Q4-base:1.5
pkgsrc-2011Q4:1.5.0.26
pkgsrc-2011Q4-base:1.5
pkgsrc-2011Q2:1.5.0.24
pkgsrc-2011Q2-base:1.5
pkgsrc-2009Q4:1.5.0.22
pkgsrc-2009Q4-base:1.5
pkgsrc-2008Q4:1.5.0.20
pkgsrc-2008Q4-base:1.5
pkgsrc-2008Q3:1.5.0.18
pkgsrc-2008Q3-base:1.5
cube-native-xorg:1.5.0.16
cube-native-xorg-base:1.5
pkgsrc-2008Q2:1.5.0.14
pkgsrc-2008Q2-base:1.5
pkgsrc-2008Q1:1.5.0.12
pkgsrc-2008Q1-base:1.5
pkgsrc-2007Q4:1.5.0.10
pkgsrc-2007Q4-base:1.5
pkgsrc-2007Q3:1.5.0.8
pkgsrc-2007Q3-base:1.5
pkgsrc-2007Q2:1.5.0.6
pkgsrc-2007Q2-base:1.5
pkgsrc-2007Q1:1.5.0.4
pkgsrc-2007Q1-base:1.5
pkgsrc-2006Q4:1.5.0.2
pkgsrc-2006Q4-base:1.5
pkgsrc-base:1.1.1.1
TNF:1.1.1;
locks; strict;
comment @# @;
1.5
date 2006.11.05.09.09.20; author rillig; state dead;
branches;
next 1.4;
1.4
date 2006.11.05.07.24.33; author rillig; state Exp;
branches;
next 1.3;
1.3
date 2006.10.25.21.33.59; author rillig; state Exp;
branches;
next 1.2;
1.2
date 2006.10.06.21.44.30; author rillig; state Exp;
branches;
next 1.1;
1.1
date 2006.10.06.21.10.41; author rillig; state Exp;
branches
1.1.1.1;
next ;
1.1.1.1
date 2006.10.06.21.10.41; author rillig; state Exp;
branches;
next ;
desc
@@
1.5
log
@Removed the pkgsrc portability book, as editing DocBook XML is no fun at
all. The contents has been moved to the NetBSD wiki at:
http://wiki.aydogan.net/index.php/The_pkgsrc_portability_guide
@
text
@
C/C++: functions
This chapter contains the requirements for using certain functions
in C and C++ code.
Feature test macros
When writing code that conforms to a specific standard, some
programmers may want to check that really only features from that
standard are used. For that purpose there exist a number of so-called
feature test macros that can be defined on the command line to the
compiler or in C and C++ source files before including any of the
standard include files.
Documentation of the feature test macros
PlatformLocation
SunOS-*-*standards(5)
NetBSD-*-*/usr/include/sys/featuretest.h
Linux-*-*/usr/include/features.h
Functions on various platforms
asprintf
Solaris 10 does not have this function. But it has
snprintf, which can be used as a good replacement.
getopt
Solaris provides the getopt function in three
of the standard headers: <stdio.h>, <stdlib.h> and
<unistd.h>, but the latter definition depends on other feature
test macros than the first two. Additionally, since Solaris 5.10, there
is also <getopt.h>, which provides
getopt_long, but not getopt.
The exact behavior also depends on the compiler. While SUNpro is quite
strict and requires the feature test macros, gcc finds the definition
without any of these macros. (TODO: Investigate further.)
Platform
Library
Headers
Feature test macros
NetBSD-*-*
c
unistd.h
_POSIX_C_SOURCE >= 2 || _XOPEN_SOURCE >= 4 || defined(_NETBSD_SOURCE)
SunOS-5.10-*
c
unistd.h
(_XOPEN_SOURCE && _XOPEN_VERSION == 4) || __EXTENSIONS__
nanosleep
On Solaris, the rt library is needed.
@
1.4
log
@+ asprintf
@
text
@d1 1
a1 1
@
1.3
log
@+ nanosleep
@
text
@d1 1
a1 1
d38 8
@
1.2
log
@Added an introduction to feature test macros and tried to describe the
conditions under which getopt(3) is declared properly on Solaris, but
that's not easy.
@
text
@d1 1
a1 1
d78 7
@
1.1
log
@Initial revision
@
text
@d1 1
a1 1
d9 10
d20 16
d37 16
a52 1
a53 1
Function name
a61 1
getopt
a67 1
getopt
d75 1
a75 1
d77 2
@
1.1.1.1
log
@Imported portability-book.
The pkgsrc portability book covers many of the platform-specific issues
that are useful when writing programs that are portable to a great
number of UNIX-like operating systems.
@
text
@@