Re: Extension to the FFI to allow macro expansions to be avoided

Fergus Henderson <[email protected]> Thu, 15 Apr 2004 04:38:49 +1000
Newsgroups gmane.comp.lang.haskell.ffi
Message-ID <[email protected]>
On 13-Apr-2004, Ross Paterson <[email protected]> wrote:
> On Tue, Apr 13, 2004 at 11:55:47AM +0100, Simon Marlow wrote:
> > > I'd favour turning off the
> > > macro interface, preferably with #undef, at least by default.
> > 
> > Agreed.  Why is #undef to be preferred over adding parentheses around
> > the function name as Ian originally suggested?
> 
> It would also switch off
> 
> #define func another_func
> 
> and
> 
> #define errno thread_local_errno()

Why is that preferred?  Undefining errno means that it won't work!

As the C standard says:

 |        It is unspecified whether errno
 |        is a macro or an identifier declared with external  linkage.
 |        If  a  macro  definition is suppressed in order to access an
 |        actual object ...  the behavior is undefined.

-- 
Fergus Henderson                    |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.