I run into this problem in the debugger with inline code in .h files like:
returns.
and statements, on separate lines these days.
"Joseph M. Newcomer" <newcomer@flounder.com> wrote in message
One of the problems of many statements on one line is that the debugger is
line-oriented,
so it executes all statements on the line before proceeding. Or doesn't
execute them. And
you can't tell.
A trick I show my students is for a polling loop
while(condition);
by putting it all one one line, you can debug the program easily. (The
next lesson is how
to remove the polling loop, because while they are debugging the machine
is amazingly
sluggish, and I want them to have this experience so they know (a) never
to use a polling
loop and (b) how to avoid them)
joe
On Wed, 9 May 2007 15:08:35 +0100, "David Webber"
<dave@musical-dot-demon-dot-co.uk>
wrote:
"Daniel James" <wastebasket@nospam.aaisp.org> wrote in message
news:VA.000010af.7ef4b3de@nospam.aaisp.org...
if ( i == 0)
{
i = 10;
k = 99;
}
else
i = 12;
Ugghh!
if( i ) { i=12; }
else { i=10; k=99; }
NB:
Two short statements on a line are good!
If one branch has {} then the other has to match!
In a mono font in the editor the two { and the two } MUST ALIGN!
One has to have STANDRADS after all!
I'm all for
if( ..)
{
...
}
but don't do it *gratuitously* :-)
The trouble with styles is that they *are* largely matters of taste that
have
no direct bearing on the productivity or efficiency of the coding
process.
Actually i find them very helpful for efficient maintainability.
Remember: De gustibus non disputandum est.
Good for Mr Gustibus, I say!
Dave
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm