RE: So weird!

  • From: "Delaunay Christophe" <christophe.delaunay@xxxxxxxxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Tue, 27 Jul 2010 10:52:41 +0200

Hi Jes,
Sorry. I can't really figure out what your problem is. However, by
reading the piece of pseudo-code you wrote, I noticed that braces are
not balanced.

The exact syntax of a do ... while statement is

do { block_of_code; } chile ( expression );

There should not be a closing brace after the "while (expression )".

So, if I use this scheme to rewrite your sample, I would have written:

do
{
        Block 1 of code;
        Block 2 of code;
}
while ( (something != this) && (something != that) );
return 0;
} // end of main function

In other words, you can notice that I did not report the "} //end while"
line sinc it is the cause of a compilation error.
HTH. Have a nice day. Chris D

-----Original Message-----
From: programmingblind-bounce@xxxxxxxxxxxxx
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Jes
Sent: mardi 27 juillet 2010 10:32
To: programmingblind@xxxxxxxxxxxxx
Subject: So weird!

I notice that sometimes when I am coding an algorithm, I'll put in a
block of code that works rock solid every time it is executed. For
example:
do
{
Block 1 of code
cblock 2 of code;

}
while (something != this && something != 'that');

} //end while
return 0;
} //end of main function
Then, for whatever reason, I'll type that exact set of instructions
somewhere else, by hand, and it won't compile, but when I select the
rock solid portion of code and copy it, the program compiles just fine.
How strange. Is this just me? Sorry if I am confusing all you peepers to
death!
Jes
__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind

Other related posts: