Miscellaneous > Programming & Networking

Fucking Confusing++

<< < (5/5)

Kintaro:

quote:Originally posted by Chooco:

--- Code: ---
--- End code ---
then it has this

--- Code: ---
--- End code ---

you have it set so that while there is no exit level, it will set the error level to 1 then print "Bad Command or file name\n\n"
your program will forever be printing the error of "Bad Command or file name\n\n" because it's looped to do so....

or so i think.

[ December 02, 2002: Message edited by: Chooco ]

[ December 02, 2002: Message edited by: Chooco ][/b]
--- End quote ---



--- Code: ---
--- End code ---
Doesnt look that way dude.

rparsi:

quote:Originally posted by Ex Eleven / b0b 2.1:
I cant get this program to work, i commented on the source more then enough so you should understand it...

Main.cpp

--- Code: ---
--- End code ---
[/b]
--- End quote ---


In general, it's NOT a good idea to use a conditional check variable to also store data.  Here's an example of what I mean (reduces stupidity bugs which I make frequently):

int done=0;
int age=0;
while(!done)
{ age=calculateSomething();
  done=(age>=26);//same thing as 'if(age>=26){ done=1;}'
}

beltorak0:

--- Code: ---
--- End code ---
<hr></blockquote>

What if you need to validate data?

--- Code: ---
--- End code ---
watch out for endless loops.

this might make my reasoning a little clearer:
--- Code: ---
--- End code ---
I just pulled that out of my ass, so don't expect it to compile.

throwing in another variable to track can be a pain.

-t.

[ December 28, 2002: Message edited by: beltorak0 ]

Navigation

[0] Message Index

[*] Previous page

Go to full version