On Saturday, March 19, 2011 15:33:00 justin wrote:
> I need your help figure out how to handle the situation.
> 
> sample code is here: http://tinyurl.com/6ezv9uw

dont do that.  tinyurl's die, as do websites.  just attach the code.  see the 
one example func attached.

is this the only way the define is used ?  this file has no "64bit" behavior 
in it at all, only x86_64 ABI-specific behavior.

the behavior it's looking at though really shouldnt be encoded into 
applications.  apparently the code relies on whether stdargs generates a fresh 
list on the stack (and thus can be modified without modifying the original 
arguments), or if it refers directly to the original arguments.

i'd have to look up what POSIX says on the matter, but if they're going to 
delving down that far into the ABI, then it sounds like the code is fairly 
fragile.  but that's upstream's choice to write crap code.

> the configure adds -D__amd64__ to C(PP)FLAGS.
> 
> To me it should be set this on 64bit. Do I interpret that right?

no.  the compiler already takes care of defining __amd64__ for x86_64 targets, 
so there's no need to manually define it.

so if this is the only place where __amd64__ is used, then you should make 
sure the configure code never manually appends it.
-mike
AjPStr ajFmtStr(const char* fmt, ...)
{
    va_list ap;
#if defined(__amd64__) || defined (__EM64T__) || \
    defined(__PPC__) && defined(_CALL_SYSV)
    va_list save_ap;
#endif
    ajint len = 32;
    AjPStr fnew;

    fnew = ajStrNewRes(len);
    va_start(ap, fmt);

#if defined(__amd64__) || defined(__EM64T__) || \
    defined(__PPC__) && defined(_CALL_SYSV)
    __va_copy(save_ap, ap);
#endif

    fnew->Len = ajFmtVfmtStrCL(&fnew->Ptr, 0, &fnew->Res, fmt, ap);

#if defined(__amd64__) || defined(__EM64T__) || \
    defined(__PPC__) && defined(_CALL_SYSV)
	__va_copy(ap, save_ap);
#endif

    va_end(ap);

    return fnew;
}

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to