www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - report-statement (like C #warning)

reply Lukas Pinkowski <Lukas.Pinkowski web.de> writes:
Hi all,

while working on my project, I had the idea of a static report statement,
that writes some text to the command line, when compiling a module.
Something along the lines of:

report("TODO: clean this up!");

Translating to:
foo.d(120): TODO: clean this up!

I rather forget/oversee TODOs in comments (despite them being highlighted),
and I am quite too lazy to produce and manage an extra TODO.txt. It's
better when you are constantly reminded of them, rather then to search on
your own for them.

This could be also used along with assert:

assert(i!=0) report("i is not 0!");

This could look like
foo.d(120): AssertError: i is not 0!

I saw this was used in VHDL, which was quite neat.
Sep 04 2005
parent reply =?ISO-8859-1?Q?Thomas_K=FChne?= <thomas-dloop kuehne.cn> writes:
Lukas Pinkowski schrieb:
 Hi all,
 
 while working on my project, I had the idea of a static report statement,
 that writes some text to the command line, when compiling a module.
 Something along the lines of:
 
 report("TODO: clean this up!");

pragma(msg, "TODO: read the documentation ;)"); Thomas
Sep 04 2005
parent Lukas Pinkowski <Lukas.Pinkowski web.de> writes:
Thomas K├╝hne wrote:

 Lukas Pinkowski schrieb:
 Hi all,
 
 while working on my project, I had the idea of a static report statement,
 that writes some text to the command line, when compiling a module.
 Something along the lines of:
 
 report("TODO: clean this up!");

pragma(msg, "TODO: read the documentation ;)"); Thomas

Thanks! I studied almost the whole documentation, and I missed this one! Walter really thought of everything :-)
Sep 04 2005