www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/11/20/20:01:30

From: Radical DOT NetSurfer AT delorie DOT com
Newsgroups: comp.os.msdos.djgpp
Subject: Re: HELP: S_ISDIR() ?????
Date: Tue, 20 Nov 2001 19:59:10 -0500
Organization: Posted via Supernews, http://www.supernews.com
Message-ID: <91vlvtkjssiqa01r13r1sqd01bid13t8da@4ax.com>
References: <0rqivtk7vhhprds46r1a48o07rvp82isuc AT 4ax DOT com> <nh9lvt0l86tc16qlcrthud9a2gf5jiaje6 AT 4ax DOT com> <9tea9f$hee$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE>
X-Newsreader: Forte Agent 1.8/32.548
MIME-Version: 1.0
X-Complaints-To: newsabuse AT supernews DOT com
Lines: 36
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

On 20 Nov 2001 19:18:07 GMT, Hans-Bernhard Broeker
<broeker AT physik DOT rwth-aachen DOT de> wrote:

>Radical wrote:
[[snippity snip]]
>__DJGPP__ is defined *only* on DJGPP, __GNUC__ is defined on lots of
>other platforms.  If and only if you know that a particular feature is
>common to all versions of GNU CC, you should use __GNUC__.
>
>Best practice usually is to use neither of the two, but rather use
>GNU's "autoconf" to test for the exact features themselves, not the
>platform they run on.  Then you can write things like #if
>HAVE_SYS_STAT_H or #if HAVE_SNPRINTF and so on.

I've seen that done, too.

>In the original case at hand, you'ld write
>
>#ifndef S_ISDIR 
># if defined(S_IFDIR) && defined(S_IFMT)
>#  define S_ISDIR(m) ((m & S_IFMT) == S_IFDIR)
># else
>#  error "no definition of S_ISDIR!"
>#endif

very interesting

>and be done with it.
>
>> in that someone who wants to compile for Linux GCC and not just
>> MSDOS/DJGPP, is GNUC acceptable?
>
>Probably no. You don't know where else GNU CC is used.

Thanks all.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019