Dear all,my footprint of 51 on my project board is PLCC44,so the ICE can't be used(footprint is DIP40).I have to connect the 51's serial port to PC and dump everthing I need to it.So the program of debug version are full of "printf" statements which are unnecessary on release version.Thus,Can we write a "TRACE" macro to resolve it?MFC implement it for us while Keil C don't.
You need something like this:
ifdef DEBUG //Debug mode - TRACE causes printf output #include <stdio.h> #define TRACE(params) printf params; #else //Release mode - TRACE expands to nothing! #define TRACE(params) #endif // DEBUG
void some_func( char x ) { TRACE( ("Entered some_func( %bX )", x) ) : : }