On Mon, 12 Jan 2009 22:31:50 -0800, Henry Willard wrote:
>
>"memcpy( &ap, &xp, sizeof( va_list ) );" is not legal C. Either use the
>c99 va_copy ("va_copy(ap,xp)") created for this purpose or define
>_VARARG_EXT before including stdarg.h. Up until c99 there was no defined
>way to do what you were trying to do although your method as well as
>direct assignment worked on many but not all systems.
>
Thanks for educating me.  Hmmm...

#define _VARARG_EXT_

leads to:

Trying vsnprintf();
CEE3204S The system detected a protection exception (System Completion 
Code=0C4).
         From entry point f2 at compile unit offset +000001A4 at entry offset 
+000001A4 at address 448CCADC.
[1] + Done(139) gmake varg && ./varg
  67109204      Segmentation violation  ./varg

... a step backward.  If vsnprintf() is incompatible with _VARARG_EXT_,
it would be a courtesy to the programmer to manifest this at compile
time, possibly by using char** instead of va_list to expose the
incompatibility.

I see that va_copy() is defined as:

      #define va_copy(dest, src) ((dest) = (src))

... simple enough.  But our systems programmer hasn't configured
the c99 environment.

If I undefine and redefine va_start, adding a call to va_arg at
the end, it works OK.  But my real goal is to get it working in
enhanced ASCII mode.  And that fails with:

c89 -I.. -D_ALL_SOURCE   -Wa,"ASA,RENT" -Wl,xplink,EDIT=NO -Wc,dll,ascii   -o 
varg ../source/varg.c /usr/lib/Xaw.x /usr/lib/SM.x /usr/lib/ICE.x 
/usr/lib/X11.x -lcurses
-sh 0 + ./varg
-sh 0 + 2<& 1
-sh 0 + iconv -f ISO8859-1 -t IBM-1047
CEE3204S The system detected a protection exception (System Completion 
Code=0C4).
         From entry point f2 at compile unit offset +00000060 at entry offset 
+00000060 at address 448F0190.
Format: " %s -- %s "

Thanks,
gil

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to