tech-userlevel archive

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

Re: must use gcc builtin?

On Fri, 24 Feb 2012 08:57:16 +0200
Alan Barrett <> wrote:

> On Tue, 21 Feb 2012, James K. Lowden wrote:
> > Just for fun, I thought I'd try compiling Gary Capell's 
> > "wily" editor. The code is from 2006, hardly ancient.  Its 
> > library manipulates a va_list as pointer using assignment and 
> > subtraction.  AFAICT the above code makes that impossible.  The 
> > compiler certainly doesn't like it.
> We have wily-0.13.41 in pkgsrc/editors/wily, and I don't see it 
> doing that sort of manipulation of va_list.

Hmm.  The pkgsrc Makefile uses  I took all three tarballs
from  ISTR something in the README
or so indicating the editor needs the libraries, so I started compiling
them.  The file I'm referring to unpacks
to ./9libs-1.0.1/libplan9c/doprint.c.  

I hit the compilation error and started to consider the the technique
employed.  When I'd convinced myself that it was hard to improve on,
even if nonstandard, I wrote to this list asking if requiring the
builtin was really a good idea.  (I refused to call such code
"incorrect" or "broken" because I don't consider the C standard to be
the arbiter of correctness.  Insofar as possible NetBSD should
permit that which is not forbidden.)  

The ensuing discussion forced me to think more carefully about
stdargs.  I now see the use of the builtin is helpful because it gives
the macro access to the compiler's stack strategy.  

> --apb (Alan Barrett)


Home | Main Index | Thread Index | Old Index