Hilbert's Hotel

Diskussionsforum zur Unendlichkeit: Theismus, Atheismus, Primzahlen, Unsterblichkeit, das Universum...
Discussing Infinity: theism and atheism, prime numbers, immortality, cosmology, philosophy...

Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (TipmyPip, AndrewAMD), 911 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Coding practices - Arghh #281402
07/27/09 05:09
07/27/09 05:09
Joined: Dec 2006
Posts: 434
UK,Terra, SolarSystem, Milky W...
pararealist Offline OP
Senior Member
pararealist  Offline OP
Senior Member

Joined: Dec 2006
Posts: 434
UK,Terra, SolarSystem, Milky W...
This i hate:

void SomeFunction() {

...bla bla

}

I would like to meet the person who came up with that and
the reason for it.
But then again i am an old timer used to
void SomeFunction()
{

...bla bla

}
Dont know why, but it is one of these (little) things that
drive me MAD.
Sorry for the ranting, but are there any other "Normal"
people out there?


Last edited by pararealist; 07/27/09 05:10.

A8.3x Commercial, AcknexWrapper and VS 2010 Express
○pararealist now.
Re: Coding practices - Arghh [Re: pararealist] #281405
07/27/09 05:46
07/27/09 05:46
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Me too, but some say I have even worse habits.

Code:
...
if(something)
{   blah;
    if(something)
    {   blah;
        if(something)
        {   blah;
            while(1)
            {
                blah...
}   }   }   }




"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: Coding practices - Arghh [Re: EvilSOB] #281410
07/27/09 06:31
07/27/09 06:31
Joined: Dec 2006
Posts: 434
UK,Terra, SolarSystem, Milky W...
pararealist Offline OP
Senior Member
pararealist  Offline OP
Senior Member

Joined: Dec 2006
Posts: 434
UK,Terra, SolarSystem, Milky W...
Well let them talk, it looks ordered to me.


A8.3x Commercial, AcknexWrapper and VS 2010 Express
○pararealist now.
Re: Coding practices - Arghh [Re: pararealist] #281423
07/27/09 07:41
07/27/09 07:41
Joined: Oct 2004
Posts: 4,134
Netherlands
Joozey Offline
Expert
Joozey  Offline
Expert

Joined: Oct 2004
Posts: 4,134
Netherlands
You'll hate me grin


Click and join the 3dgs irc community!
Room: #3dgs
Re: Coding practices - Arghh [Re: Joozey] #281457
07/27/09 12:08
07/27/09 12:08
Joined: Feb 2009
Posts: 2,154
Damocles_ Offline
Expert
Damocles_  Offline
Expert

Joined: Feb 2009
Posts: 2,154
I also dont like brackets shifted like this.
Its a freak habbit.

Especially when there is no "bracket detection"
its hard to see wich opening-bracket belongs to wich closing one.

Basically: the opening bracket should have the same x position
as the closing one. And the contest should be shifet (tab or just
a defined amount of spaces)
The only difference is a one-liner
if(me==god) { ..do almighty things.. }

Well formated and commented code is often more important than
super-optimized algorythms, as the programmer has it easier to
rework the code month later, and find bugs.

Re: Coding practices - Arghh [Re: Damocles_] #281459
07/27/09 12:15
07/27/09 12:15
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline
Serious User
DJBMASTER  Offline
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
EvilSOB's way is what i prefer. You can see which logic belongs where instead of having to find each brace. I use 'Switch' 99% of the time because i can read it better.

Re: Coding practices - Arghh [Re: DJBMASTER] #281512
07/27/09 15:15
07/27/09 15:15
Joined: Aug 2003
Posts: 7,439
Red Dwarf
Michael_Schwarz Offline
Senior Expert
Michael_Schwarz  Offline
Senior Expert

Joined: Aug 2003
Posts: 7,439
Red Dwarf
whoa, finally some sane people here!

I really hate those two things too. I really have to a agree with Damocles.
Indention is a ABSOLUTE MUST!

What drives me crazy, when comparisons have no spaces in between.. umm... well just see (assuming it's a short, one liner):

Code:
if(me>=god){...}



for me it _MUST_ look clean and neat like this:

Code:
if(me >= god) { ... }



you can see my coding style if you take a peek at my code snippets you can find in my blog *cough**shameless self-advertising**cough*


"Sometimes JCL reminds me of Notch, but more competent" ~ Kiyaku
Re: Coding practices - Arghh [Re: Michael_Schwarz] #281516
07/27/09 15:44
07/27/09 15:44
Joined: May 2002
Posts: 7,441
ventilator Offline
Senior Expert
ventilator  Offline
Senior Expert

Joined: May 2002
Posts: 7,441
this is one reason i like python. smile

Re: Coding practices - Arghh [Re: ventilator] #281523
07/27/09 16:07
07/27/09 16:07
Joined: Feb 2006
Posts: 2,185
mpdeveloper_B Offline
Expert
mpdeveloper_B  Offline
Expert

Joined: Feb 2006
Posts: 2,185
I agree with pararealist to a point, but I also agree with Michael. My general code is:

Code:
function blahblah()
{
     if (blah >= blahblah)
     {
          //insert alot of code
     }
}



but, if it can be a one-liner, I go this way:

Code:
function exit_() { while(key_any) { wait(1); ) exit; }



I generally don't put alot of ifs as one liners, but whiles i do and functions i do. It's just a pet peeve. I just go for organization...I can't stand out of place code and brackets that are put right after the function name. There's nothing wrong with people who do it that way, but I don't and I think it looks tacky....

edit: I also normally use a Tab indention, I don't like a 5 space like i have in my examples.

edit: yes evilSOB....that's a reaaaaaaaly bad habit.....

Last edited by mpdeveloper_B; 07/27/09 16:11.

- aka Manslayer101
Re: Coding practices - Arghh [Re: mpdeveloper_B] #281566
07/27/09 18:22
07/27/09 18:22
Joined: Oct 2004
Posts: 4,134
Netherlands
Joozey Offline
Expert
Joozey  Offline
Expert

Joined: Oct 2004
Posts: 4,134
Netherlands
This is my style, shiver already:
Code:
void test( int arg ) { <- I can't stand code without space between parameter and brackets
  
  displayNumber( arg, 14, 23 );
  
  if( arg < 10 ) {
    arg = test( arg + 1 );
  }

  else if( arg == -1 ||
           arg == -3 ||
           arg == -5 ) {
    return -1;
  }

  else { return 0; }
}



Last edited by Joozey; 07/27/09 18:25.

Click and join the 3dgs irc community!
Room: #3dgs
Page 1 of 2 1 2

Moderated by  jcl, Lukas, old_bill, Spirit 

Kompaktes W�rterbuch des UnendlichenCompact Dictionary of the Infinite


Powered by UBB.threads™ PHP Forum Software 7.7.1