>From: Paul Eggert <yyyyyy@xxxxxxxxxxx>
>hard to write, read, and maintain. Instead, application writers
>should use code like this:
> printf(_("process ID = %ld, parent process ID = %ld\n",
> (long)getpid(), (long)getppid());
>This is much easier to write and maintain, is much more reliable, and
>works on all current platforms.
>Once C99 can be assumed, application writers can replace the above
>code with this:
> printf(_("process ID = %jd, parent process ID = %jd\n",
> (intmax_t)getpid(), (intmax_t)getppid());
>This will work even on (currently hypothetical) platforms where pid_t
>is wider than long.
This solution has the disadvantage that
- intmax_t may even be 128 bit in a 32 bit system and thus
make the code bigger (5-10% typicaly) on an average system
where the pid_t values have to be extended.
- it may make things much slower than before.
BTW: I again see the advantage that I have my own portable printf()
that I use with my open source code.....
Jörg
EMail:yyyyy@xxxxxxxxxxxxxxxxxxxxxxxxxxx (home) Jörg Schilling D-13353 Berlin
yy@xxxxxxxxxxxxxxx (uni) If you don't have iso-8859-1
yyyyyyyyy@xxxxxxxxxxxx (work) chars I am J"org Schilling
URL: http://www.fokus.gmd.de/usr/schilling ftp://ftp.fokus.gmd.de/pub/unix
|