Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

C++ structure?

Name: Anonymous 2008-08-26 18:59

What's the correct structure for coding? Where are you supposed to put the braces "{}" at? When and where are you supposed to indent or use blank spaces?

This:

int main(){
  cout << "Hello World!";
  return 0;}


or this:
int main()
{
  cout << "Hello World!";
  return 0;
}

Is there a tutorial or book for this?

Name: Anonymous 2008-08-26 19:05

NO EXCEPTIONS

Name: Anonymous 2008-08-26 19:08

>>2
How did you do that?

____________
NO EXCEPTION
------------

Name: Eric Allman 2008-08-26 19:10

The correct way is all braces on their own line and 4 space indents. Don't let trolls tell you otherwise.

Name: Anonymous 2008-08-26 19:15

>>4

When and where are you supposed to indent?

Name: Anonymous 2008-08-26 19:18

stop all the downloooaddinnnn

Name: Anonymous 2008-08-26 19:19

The correct way is K&R, of course. 4 spaces, braces together with whatever they open and alone only if they are closing something not followed by else or (do..)while, no spaces after function names but one space after statement names, no spaces inside parens, and one space around binary or ternary infix operators.

Also, ttp://www.python.org/dev/peps/pep-0008/

Name: Anonymous 2008-08-26 23:05

The correct way is Anonix, of course. 1 space, braces together with whatever they open and alone onlly if they are closing something not followed by else or do...while, no spaces after function names nor after statement names, no spaces inside parens, and no space around any operators.

Also, ttp://rechan.eu.org/misc/anoncoreutils/CODEGUIDELINES

Name: Anonymous 2008-08-27 0:06

K&R 4 spaces bitch

Name: Anonymous 2008-08-27 6:14

tabs or gtfo

Name: Anonymous 2008-08-27 9:38

>>8
TTP Transfer Protocol

Name: Anonymous 2008-08-28 15:37

I'M C++

SON OF A BITCH JAVA

JAVA IS PIG

DO YOU WANT OBJECT ORIENTED?

DO YOU WANT SHORT CIRCUIT?

JAVA IS PIG DISGUSTING

SUN MICROSYSTEMS IS A MURDERER

FUCKING JAVA

Name: Anonymous 2008-08-28 15:55

Name: Anonymous 2008-08-28 16:31

>>8
i swear i've seen php code with similar indentation/spacing, is that the norm for php?

Name: Anonymous 2008-08-28 19:24

>>15
DO YOU WANT SHORT CIRCUIT?
wat

Name: Anonymous 2008-08-28 20:03

>>3
7/10

Name: Anonymous 2008-08-28 21:50

>>1
Visit the pedo of wiki and link for "indent styles" - you will find many.  Each has its advantages and disadvantes.  I prefer two spaces for indentation and braces on their own lines (modified BSD style in emacs, basically).

Name: Anonymous 2008-08-28 22:16

>>14
The ``norm'' for PHP is haphazard spacing with no regard for legibility and no considerations regarding line length.

ANONIX's spacing may be less haphazard, but it's still illegible.

Name: Anonymous 2008-08-29 0:17

What's wrong with tabs?

Name: Anonymous 2008-08-29 0:21

This is correct:
int foo(int, double);

int
foo (int a, double b)
{
//code goes here—indent with tabs
}

Name: Anonymous 2008-08-29 0:55

>>20
You lie.

Name: Anonymous 2008-08-29 1:12

>>21
You wish.

Name: Anonymous 2008-08-29 3:23

Indentation with tabs should be punishable by death.

Name: Anonymous 2008-08-29 5:14

>>23
Indentation with anything but tabs is a clear sign of psychosis.

Name: Anonymous 2008-08-29 5:35

>>24
Enjoy your explosion at the ASCII factory.

Name: Anonymous 2009-03-06 10:15

of Image num for   the class name   deaths kills etc   just duplicated for   each class Like   MyClass and MyClass2   with this method   should write the   damn thing in   C takes about   the same amount   of time Nevermind   That reinvent the   wheel again for   the 40th time.

Don't change these.
Name: Email:
Entire Thread Thread List