Wednesday, November 17, 2004

#define variable arguments

Since #define does not take variable arguments you have to work around using function pointers.


void __format_out(const char* fmt, ...);

typedef void (*ptr2Fn) (const char* fmt, ...) ;

ptr2Fn _storeLine(int nSeverity,int lineNumber,char* fileName);

#define CTRACE _storeLine(40,__LINE__,__FILE__)

-----------------------
ptr2Fn _storeLine(int nPSeverity,int nPlineNumber,char* szPfileName)
{

nSeverity = nPSeverity;
nlineNumber=nPlineNumber;
szfileName = (char*)szPfileName;

return __format_out;
}
-----------------------
inline void __format_out(const char * fmt, ...)
{

CString ___str;
va_list marker;
va_start(marker, fmt);
USES_CONVERSION;
___str.FormatV(A2T(fmt), marker);
va_end(marker);


}

TRACE("nUMBER IS %d",223);

No comments:

Install/Upgrade NVIDI Driver in Ubuntu for CUDA SDK

Most linux distribution comes with the Nouveau https://nouveau.freedesktop.org/wiki/ display driver configured. If you need to use NVIDIA...