autoconf
[Top][All Lists]
Advanced

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

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


From: Ed Hartnett
Subject: Re: can autoconf determine if a preprocessor macro is defined or not?
Date: Thu, 27 Jul 2006 09:06:42 -0600
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.4 (gnu/linux)

Keith MARSHALL <address@hidden> 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  -- address@hidden





reply via email to

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