[ Filip Strugar @ 02.09.2006. 02:52 ] @
Može li još neko probati da iskompajlira ovo parče koda u Visual C++ 8.0, kod mene se ne kompajlira :) Code: #include <new.h> //hackfix: //template<class T> void * internal_alloc( int locationID, int lineNumber, const char * pFileName, const char * pCompilerBugFix = 0 ) template<class T> void * internal_alloc( int locationID, int lineNumber, const char * pFileName ) { return 0;//malloc( sizeof(T) ); } //hackfix: //#define internal_new( __obj_type, ... ) new( internal_alloc<__obj_type>( __COUNTER__, __LINE__, __FILE__, "" ) ) __obj_type( __VA_ARGS__ ) #define internal_new( __obj_type, ... ) new( (internal_alloc<__obj_type>(__COUNTER__, __LINE__, __FILE__)) ) __obj_type( __VA_ARGS__ ) void main() { int * pTest1 = internal_new( int ); // this one doesn't work properly int * pTest2 = internal_new( int, 1 ); // this one works properly // preprocessed output, buggy version: //int * pTest1 = new( (internal_alloc<int>(0, 16 ".\\blahblah.cpp")) ) int( ); <- notice the missing comma after '16' //int * pTest2 = new( (internal_alloc<int>(1, 17, ".\\blahblah.cpp")) ) int( 1 ); // preprocessed output, hackfix: //int * pTest1 = new( internal_alloc<int>( 0, 16, ".\\blahblah.cpp" "" ) ) int( ); //int * pTest2 = new( internal_alloc<int>( 1, 17, ".\\blahblah.cpp", "" ) ) int( 1 ); } Bug je u preprocesoru, skida pogresan zarez za slucaj kad __VA_ARGS__ nema argumente! |