Skip to main content
gamedev.net
🔒 Locked

macros

Started by m0n0n0ke Sep 5, 2003 at 1:45 PM 6 replies 300+ views
Original Post
m0n0n0ke
m0n0n0ke
i don''t want to write in each files #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif i wanted to create a macro so that in the beginning of each files i just have to write DEBUG_MEM, but it doesn''t seem to work. here is my macro : #define DEBUG_MEM \ #ifdef _DEBUG \ #define new DEBUG_NEW \ #undef THIS_FILE \ static char THIS_FILE[] = __FILE__; \ #endif and here is the error i have when i write DEBUG_NEW error C2121: ''#'' : invalid character : possibly the result of a macro expansion.
antareus
antareus
Macro commands cannot expand to include other macro commands.
--God has paid us the intolerable compliment of loving us, in the deepest, most tragic, most inexorable sense.- C.S. Lewis
m0n0n0ke
m0n0n0ke
ok thanks
m0n0n0ke
m0n0n0ke
the macro is compiling with the {} but if i try to use DEBUG_MEM in my other files it''s still the same error ;(

I think it''s impossible as antareus said.

Fruny
Fruny
quote:
Original post by Mihail121
Bet 5 bucks they can?



I bet they cannot. Are you confident enough to raise the stakes, say to US$50 ?


[ Start Here ! | How To Ask Smart Questions | Recommended C++ Books | C++ FAQ Lite | Function Ptrs | CppTips Archive ]
[ Header Files | File Format Docs | LNK2001 | C++ STL Doc | STLPort | Free C++ IDE | Boost C++ Lib | MSVC6 Lib Fixes ]
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
Mihail121
Mihail121
quote:
Original post by Fruny
quote:
Original post by Mihail121
Bet 5 bucks they can?



I bet they cannot. Are you confident enough to raise the stakes, say to US$50 ?


[ Start Here ! | How To Ask Smart Questions | Recommended C++ Books | C++ FAQ Lite | Function Ptrs | CppTips Archive ]
[ Header Files | File Format Docs | LNK2001 | C++ STL Doc | STLPort | Free C++ IDE | Boost C++ Lib | MSVC6 Lib Fixes ]



Damn just tested it,you can''t but oh well FUCK you have a bet.Come to Sofia to resieve them!

P.S.
Plane ticket == $1200



http://mihail121.tripod.com

Fruny
Fruny
quote:
Original post by Mihail121
Damn just tested it,you can''t but oh well FUCK you have a bet.Come to Sofia to resieve them!

P.S.
Plane ticket == $1200



No problem, I''ll pass by next year when I''m in Europe


[ Start Here ! | How To Ask Smart Questions | Recommended C++ Books | C++ FAQ Lite | Function Ptrs | CppTips Archive ]
[ Header Files | File Format Docs | LNK2001 | C++ STL Doc | STLPort | Free C++ IDE | Boost C++ Lib | MSVC6 Lib Fixes ]
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.