Arce's random garbage from my Null purification topic.

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
Guest

Post by Guest »

I am just learning C++. In 18 days (I'm reading Teach Yourself C++ in 21 Days, I'm on #4) I think I might attempt to learn SDL.

JS Lemming, why do you use that style? Isn't it just more typing? I honestly don't see a reason to do that is you could achieve the same thing without the {}'s.

Code: Select all

void SetLife(int value) 
{ 
   life = value; 
   if(life > maxlife) { life = maxlife; } 
} 
I would write as:

Code: Select all

void setLife(int value) {
     life = value;
   
     if (life>maxlife)
          life = maxlife;
}
I dunno, I guess it's just a matter of person taste. According to Jesse Liberty, the best way to start a religious war is to ask two programmers the best style to program with.

The dude in the book I'm reading programs kinda like you, JS Lemming. lol
Guest

Post by Guest »

Yeah, I know these people in real life and they're learning to dev for the PC. None of them will squeal because I know where they live.
You don't know where I live. And if you ever find out, I'll kill your whole family! MUHAHAHAHAH! :twisted:
User avatar
JS Lemming
Game Developer
Game Developer
Posts: 2383
Joined: Fri May 21, 2004 4:09 pm
Location: C:\CON\CON

Post by JS Lemming »

I just use that style cause a lot of times I have about 50 if statements embedded into each other. Without the brackets I would easly loose which if is in another if.
Small girl at the harbor wrote:Look Brandon, that crab's got ham!
Post Reply