3248 |
@end menu |
@end menu |
3249 |
|
|
3250 |
@node Function Portability, Particular Functions, Library Functions, Library Functions |
@node Function Portability, Particular Functions, Library Functions, Library Functions |
3251 |
@subsection Portability of Classical Functions |
@subsection Portability of C Functions |
3252 |
|
|
3253 |
Most usual functions can either be missing, or be buggy, or be limited |
Most usual functions can either be missing, or be buggy, or be limited |
3254 |
on some architectures. This section tries to make an inventory of these |
on some architectures. This section tries to make an inventory of these |
3255 |
portability issues. By definition, this list will always require |
portability issues. By definition, this list will always require |
3256 |
additions, please help us keeping it as complete as possible |
additions. Please help us keeping it as complete as possible. |
3257 |
|
|
3258 |
@table @asis |
@table @asis |
3259 |
|
@item @code{snprintf} |
3260 |
|
@c @fuindex snprintf |
3261 |
|
@prindex @code{snprintf} |
3262 |
|
@c @fuindex vsnprintf |
3263 |
|
@prindex @code{vsnprintf} |
3264 |
|
The ISO C99 standard says that if the output array isn't big enough and |
3265 |
|
if no other errors occur, @code{snprintf} and @code{vsnprintf} truncate |
3266 |
|
the output and return the number of bytes that ought to have been |
3267 |
|
produced. Some older systems return the truncated length (e.g., GNU C |
3268 |
|
Library 2.0.x or IRIX 6.5), some a negative value (e.g., earlier GNU C |
3269 |
|
Library versions), and some the buffer length without truncation (e.g., |
3270 |
|
32-bit Solaris 7). Also, some buggy older systems ignore the length and |
3271 |
|
overrun the buffer (e.g., 64-bit Solaris 7). |
3272 |
|
|
3273 |
@item @code{sprintf} |
@item @code{sprintf} |
3274 |
@c @fuindex sprintf |
@c @fuindex sprintf |
3275 |
@prindex @code{sprintf} |
@prindex @code{sprintf} |
3276 |
|
@c @fuindex vsprintf |
3277 |
|
@prindex @code{vsprintf} |
3278 |
The ISO C standard says @code{sprintf} and @code{vsprintf} return the |
The ISO C standard says @code{sprintf} and @code{vsprintf} return the |
3279 |
number of characters written, but on some old systems (SunOS for |
number of bytes written, but on some old systems (SunOS 4 for |
3280 |
instance) they return the buffer pointer instead. |
instance) they return the buffer pointer instead. |
3281 |
|
|
3282 |
@item @code{unlink} |
@item @code{unlink} |