From: Raja R Harinath (harinath_at_[hidden])
Date: 2000-02-17 12:05:33
"Miki Jovanovic" <miki_at_[hidden]> writes:
> How do you keep track of places in your code which you need to re-visit
> to improve, implement of check otherwise? For the longest time I was
> using comments like:
> // TODO: Fix this.
> But little while ago there was a discussion on one of the boards about
> #pragma message, and I wrote a macro that I found irreplaceable since.
> So, here it is, and you all can tell me if there is a place in the
> boost library for it.
> #define hidden_quote( s ) #s
> #define hidden_numquote( n ) hidden_quote( n )
> #define TODO( msg ) message( __FILE__ "(" hidden_numquote( __LINE__ )
> "): TODO: " msg )
> The only macro that should be used is the TODO. It lets you put
> comments in your code like this:
> #pragma TODO( "Fix this." )
Unfortunately, I don't want to play Nethack ;-)
Seriously, this is not portable, since
1. not all compilers support the same pragmas
2. even if they do support the "message" pragma, it may mean
3. I'm not sure if you're allowed to expand macros inside a #pragma
> Nice thing about the macro is that it identifies file and line number,
> and it lets IDE's take you there immediately. Not so nice thing...
> #pragma is not in the macro. If anyone can put it in, please let me
Well, C9x has _Pragma (sp?), which you can put into a macro. Maybe
some C++ compilers will have that as compiler-specific extensions.
 Pragmas have implementation defined behaviour. Folklore has it
that there were versions of GCC where the implementation-defined
behaviour was to start a game of Nethack, a dungeons-and-dragons
-- Raja R Harinath ------------------------------ harinath_at_[hidden] "When all else fails, read the instructions." -- Cahn's Axiom "Our policy is, when in doubt, do the right thing." -- Roy L Ash
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk