Re: can autoconf determine if a preprocessor macro is defined or not?

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

 



Keith MARSHALL <keith.marshall@xxxxxxxxx> writes:

> I'm curious as to why you would expect MinGW's `sys/stat.h' to
> define these?

Because that's the case on every other platform I port to. Didn't mean
to sound critical of mingw, which I love.

> MinGW specifically targets the *native* Win32 platform.  These are
> *UNIX* specific filesystem attributes; they are *not* supported in
> native Win32.

OK.

> By defining them, you fool the compiler into believing that the OS
> supports features that it doesn't.  MinGW *deliberately* omits these
> defines, so you get a compile time error when you try to do something
> which the OS doesn't support.  By sidestepping this, you leave your
> application vulnerable to unexpected behaviour, or even failure at
> runtime; defining them is *not* a good idea.
>
> What you should be doing is recognising that these don't apply on
> the host OS, and coding so that you don't use them.  When compiling
> for a host such as Win32, use something like `#ifdef _WIN32', (or,
> for a MinGW specific test, `#ifdef __MINGW32__'), to identify these
> special cases, and provide alternative code which doesn't use
> these unsupported attributes.

I'm just trying to avoid platform-specific lines of code in my C
files.

Thanks,

Ed

-- 
Ed Hartnett  -- ed@xxxxxxxxxxxxxxxx



_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
http://lists.gnu.org/mailman/listinfo/autoconf

[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux