autoconf
[Top][All Lists]
Advanced

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

Re: Raw Arguments - last call for comment


From: Bruce Korb
Subject: Re: Raw Arguments - last call for comment
Date: Fri, 03 Nov 2000 14:38:07 -0800

Hi Eric,

I have added the autoconf list to this since they do the
paper-over-differences stuff, and I have kept the
austin-group because, ultimately, they ought to address it. :-)

Anyway, you are right that it is generally a simple macro
definition.  The trick is, not always.  Further, there are
lots of tricky variations out there and, if I don't personally
write the glue code and macro wrappers, then my app won't
port.  I do not have direct access to platforms that do not
use the argument vector implementation of va_list.  I do
have direct access to complaints about having used an assumed
argument vector in the past.  Therefore, the only straight
forward path I have seen to there from here involves special
formatting libraries that accept argument vectors in addition
to the usual va_list stuff.  If compiler writers were merely
required to provide a means for constructing a va_list,
all that re-formatting work would not have had to have been done.  :-(

Cheers,
        Bruce

Eric Vought wrote:
> 
> It seems like a simple macro definition (provided by the implementation)

Yes!  Exactly.

> would fix this problem nicely. All you need is a CONSTRUCT_VARGS macro,
> that, given an array, would construct whatever is used by the platform.
> This would preserve the platforms ability to optimize while also retaining
> portability. Platforms that use an array would define this as a noop. This
> could be put into practice now using a configure script test to create the
> appropriate macro. Obviously, the configure script would contain several
> chunks of completely non-portable code, but your application code would be
> relatively clean and would adapt well to any standardization of such a
> macro. If many people use the same configure code, it would become a de
> facto standard quickly and then can be submitted as a real standard.
> 
> On Thu, 2 Nov 2000, Bruce Korb wrote:
> 
> > address@hidden wrote:
> > > Are you talking about the fact that the va_list is an unknown type and
> > > that it may  be an array?
> >
> > It may be an array.  It may be a struct.  It may be partly stashed
> > in registers (on a register rich platform).
> >
> > > There seem to be two problems with it:
> > >
> > > -       You may need to copy va_list's
> > >
> > > -       You may want to retrieve a va_list type variable
> > >         from a var arglist.
> > >         (Needed to e.g. implement a %r recursive printf format
> > >         that takes a format string and a va_list from the arg list).
> >
> > I may also be interpreting a text file that contains a format
> > with the format arguments derived in some fashion.  My problem
> > is, "How do I call sprintf?"  I know the argument count
> > so I could:
> >
> >   switch (arg_ct) {
> >   case 0: strcpy( pDest, pFmt ); break
> >   case 1: sprintf( pDest, pFmt, arg_vector[0] ); break;
> >   case 2: ...
> >
> > I do hope you consider that insufferable, though many do just that.
> >
> > If you *know* that va list is array, then:
> >
> >   vsprintf( pDest, pFmt, arg_vector );
> >
> > works fine.  But if you are trying to be portable, you're hosed.
> > I *do* wish this oversight (i.e. construction of a va_list from
> > "scratch") were fixed.....*sigh*



reply via email to

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