Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

djberg96 (2603)

  (email not shown publicly)

Journal of djberg96 (2603)

Monday September 09, 2002
02:50 PM

Linux Magazine article

[ #7630 ]
I read an article in Linux Magazine called "Writing Portable Code". I took an interest in this article because of my Ruby port of Proc::ProcessTable, where I'm currently following Dan's technique of creating source and header files for each platform in a subdirectory, and then building the appropriate files based on a platform check within the make file.

What caught my attention is that the author, Eric Schnoebelen, says that you should use, for example, "HAVE_GETHOSTNAME_R" instead of just testing the platform with "defined __LINUX__", because it's better to test the API than the platform.

The problem with this, of course, is that he chose to use a re-entrant function in his example. The problem with re-entrant functions is that several platforms implement them, but each with their own API. Thus, the *only* way to tell *which* API to use is to test the platform at some point.


The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.