dotgnu-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [DotGNU]csunit Error on mingw


From: Rhys Weatherley
Subject: Re: [DotGNU]csunit Error on mingw
Date: Thu, 05 Dec 2002 20:34:46 +1000

"Aditya P. Bansod" wrote:
> 
> > >"#ifdef __MINGW32__" should be avoided if possible.
> 
> Is there any particular reason for this? (don't really care either way, but
> curious nonetheless).

Compilers and platforms change over time.  The mingw32 of today
probably has a different set of libraries than the mingw32 of two
years ago.  If someone has an older mingw32 installation, then
it may not work for them.  And what happens when a future version
of mingw32 adds a real lstat?  The current check won't be able
to adapt properly.

It gets even worse on Unix platforms, when dealing with the dozen
or so flavours.  Even standard definitions like STDC and POSIX_SOURCE
cannot be relied upon to work the same everywhere.

It is better to check for the feature, rather than the platform.
That's why configure does all those "checking for XXX" things: it probes
what the platform is actually doing, rather than what it claims to do.
(There are way too many #ifdef _WIN32's in the pnet code - anything
we can do to reduce them is a good thing).

The lstat check is a good one to make because there may be other
platforms that lack lstat.  It will be better to have one case of
"#ifdef HAVE_LSTAT" than a forest of #ifdef's for all the various
platforms.

You'll find a lot more information on building portable C code in
the GNU Coding Guidelines on www.gnu.org.

Cheers,

Rhys.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]