delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1998/02/12/06:33:27

Sender: vheyndri AT rug DOT ac DOT be
Message-Id: <34E2D842.343B@rug.ac.be>
Date: Thu, 12 Feb 1998 12:08:50 +0100
From: Vik Heyndrickx <Vik DOT Heyndrickx AT rug DOT ac DOT be>
Mime-Version: 1.0
To: Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de>
Cc: DJ Delorie <dj AT delorie DOT com>, djgpp-workers AT delorie DOT com
Subject: Re: char != unsigned char... sometimes, sigh
References: <Pine DOT LNX DOT 3 DOT 93 DOT 980211151419 DOT 1113D-100000 AT acp3bf>

Hans-Bernhard Broeker wrote:
> > The macro's I offered were also acceptable. Every library I've seen so
> > far (bo*nd, djgpp, FreeBSD, gnulibc) does offer a set of macro's.
> 
> That may well be so, but does that mean we have to follow what is actually
> just a tradition, based in the day when 'inline' functions weren't
> available yet in most compilers? 

Not just to follow a tradition, no, unless you are English ;)

>                                  After all, as the gcc docs state it 'an
> inline function is as fast as a macro', but it does have the benefit of
> type-safeness, and automatic demotion to a function call if the compiler
> thinks that's a better idea in a given situation.

Type-safeness is not at order, here, since that yields undefined
behaviour.
 
> But I didn't mean to imply your macro implementation weren't "acceptable",
> anyway. I just wanted to point a possible alternative. And your
> implementation using the ({ }) syntax is already rather close to an inline
> function, as well, so why not take that final step as well?

There is something nasty about inline externs. You have to put also a
version without 'inline extern' in the libc library. So far, no problem,
but as you have two instances of the same code, your risk that you
forget updating one of them when they need to be modified (not to
mention the little extra work that is involved).
If you have macro version, you can simple include that code in the
function version, and you don't have the hassles for double-modifying
it.

-- 
 \ Vik /-_-_-_-_-_-_/   
  \___/ Heyndrickx /          
   \ /-_-_-_-_-_-_/


- Raw text -


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