User not logged in - login - register
Home Calendar Books School Tool Photo Gallery Message Boards Users Statistics Advertise Site Info
go to bottom | |
 Message Boards » » fucking foreign programmers Page [1]  
Lionheart
I'm Eggscellent
12772 Posts
user info
edit post

Quote :
"for(;!f.EOF() ; )
{
...
}
"

Its called a motherfucking while loop

[Edited on May 8, 2008 at 7:33 PM. Reason : rofl at crazycode]

5/8/2008 7:29:04 PM

nothing22
All American
21537 Posts
user info
edit post

5/8/2008 7:37:19 PM

LimpyNuts
All American
16859 Posts
user info
edit post

Some people use For loops for everything. I use While (or Do as syntax may decree) loops for everything. They are functionally equivalent.

5/8/2008 8:33:43 PM

DirtyMonkey
All American
4269 Posts
user info
edit post

functionally equivalent, yes. legibly equivalent, in the OP's case, no way.

5/8/2008 9:44:21 PM

qntmfred
retired
40555 Posts
user info
edit post

i prefer GOTO

5/8/2008 10:08:51 PM

cyrion
All American
27139 Posts
user info
edit post

recursion with a counter

5/8/2008 10:48:11 PM

catalyst
All American
8704 Posts
user info
edit post

i've been made of fun of for exclusively using while loops...

never really used for seriously

5/9/2008 12:15:09 AM

Rat
Suspended
5724 Posts
user info
edit post

i use reflection for everything

5/9/2008 12:19:57 AM

LadyWolff
All American
2286 Posts
user info
edit post

I might be very wrong, but I always divided whether I used for/and while depending on
1. whether i needed access to the counter
2. whether i'm testing for a condition that is not strictly a counter (EOF, hasNext() exists() whatever)

5/9/2008 11:44:54 AM

qntmfred
retired
40555 Posts
user info
edit post

that sounds about right

5/9/2008 11:51:05 AM

evan
All American
27701 Posts
user info
edit post

while(1) {
sleep(5);
}

5/9/2008 12:01:24 PM

dubus
Veteran
311 Posts
user info
edit post

^^^^^^^ My supervisor has said he would fire someone on the spot for using a GOTO. I know the pain of dealing with their code, we usually get paid to fix it

5/9/2008 4:08:04 PM

spöokyjon

18617 Posts
user info
edit post

if ( someboolean == true)
{
return true;
}
else if (someboolean == false)
{
return false;
}

5/9/2008 5:12:19 PM

Lionheart
I'm Eggscellent
12772 Posts
user info
edit post

Quote :
"I might be very wrong, but I always divided whether I used for/and while depending on
1. whether i needed access to the counter
2. whether i'm testing for a condition that is not strictly a counter (EOF, hasNext() exists() whatever)"


Thats the normal logic which almost everyone uses, which makes reading something like that a pain.

Also, do while loops are a pain in the ass as well, what is this 1989?

5/9/2008 6:09:04 PM

cyrion
All American
27139 Posts
user info
edit post

i dont see that big of a deal with using a post-conditional with instead of a pre-conditional.

5/9/2008 6:24:34 PM

BigMan157
no u
103352 Posts
user info
edit post

sometimes you just need something to execute at least once ok

5/9/2008 9:35:22 PM

qntmfred
retired
40555 Posts
user info
edit post

yeah i actually relish the opportunity to use a do while

5/9/2008 9:49:43 PM

dakota_man
All American
26584 Posts
user info
edit post

I remember one at my last job went through and changed a bunch of

for (int i = 0; i < ??????; i++)

to

for (int i = 0; i < ??????; ++i)

for no apparent reason

5/9/2008 10:11:08 PM

Madman
All American
3412 Posts
user info
edit post

ya'lls a bunch of nerds

5/9/2008 10:28:40 PM

JaegerNCSU
Veteran
245 Posts
user info
edit post

^^ Because pre-increment is more efficient than post-increment because it doesn't create a copy. Granted for built-in types like int in the example you showed the compiler will optimize it out, but for more complicated objects that define ++ (and also --) and for iterators pre-increment is definitely what you want to do if you simply want to increment a value.

5/9/2008 10:59:23 PM

philihp
All American
8349 Posts
user info
edit post

i prefer

Quote :
"
for(;
{
if(f.EOF()) break;
...
}
"

5/9/2008 11:39:17 PM

qntmfred
retired
40555 Posts
user info
edit post

Jaeger out of nowhere with a quality post as usual

5/9/2008 11:58:29 PM

dakota_man
All American
26584 Posts
user info
edit post

Definitely quality, but like he said, it shouldn't end up making a difference. It might not even make a difference for more complicated objects (guess that depends on the compiler) since the result of i++ isn't really consumed by anything.

[Edited on May 10, 2008 at 1:30 AM. Reason : makes me wonder why the convention is to postfix in for loops though]

5/10/2008 1:22:44 AM

afripino
All American
11350 Posts
user info
edit post

Quote :
"if ( someboolean == true)
{
return true;
}
else if (someboolean == false)
{
return false;
}"


lol.

5/10/2008 10:46:48 AM

 Message Boards » Tech Talk » fucking foreign programmers Page [1]  
go to top | |
Admin Options : move topic | lock topic

© 2024 by The Wolf Web - All Rights Reserved.
The material located at this site is not endorsed, sponsored or provided by or on behalf of North Carolina State University.
Powered by CrazyWeb v2.38 - our disclaimer.