Re: #if 0
On Jan 21, 12:49 am, Juha Nieminen <nos...@thanks.invalid> wrote:
Jung, William wrote:
#if 0
m_Picture[i].Create("images/" + url);
#endif
This is a technique used to easily comment out portions of the
code. It's handy because if you want to re-include the code,
you just have to change the "0" to "1", rather than having to
touch both the beginning and the end of the comment block.
It was common practice back in the days of C---C style comments
don't nest, so bracketing the block with /*...*/ didn't work if
it contained a comment.
A variant used a reserved identifier, e.g.:
#ifdef COMMENTED_OUT
...
#endif
This had the advantage of being explicit. And the disadvantage
that there was always some idiot who'd define COMMENTED_OUT to
reactivate his commented out block, reactivating everyone elses
at the same time.
This technique has pretty much died with the introduction of C
style comments and syntax coloring in editors. It's trivial to
do something like ``'a,'bs:^:// :'' in the editor, to comment
out a block, and this results in the editor syntax coloring the
block as comments (and even without syntax coloring, you see
that the block is commented out, even if the top and bottom of
the block are not visible). It does have the disadvantage that
it doesn't directly support additional information, along the
lines of:
#ifdef COMMENTED_OUT_TO_BE_DELETED_ONCE_THE_ABOVE_WORKS
(But I've never seen such additional information effectively
used. And I've seen code with such block, in which the "above"
had been fully tested and working for the last five or six
versions.)
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34