• How do you use brackets?
    47 replies, posted
[QUOTE=t0rento;16732716]I do: [cpp] void myFunction() { int aNumber = 0; MyClass instance; if( instance.getIndex() == aNumber ) { aNumber += 1 } else { aNumber -= 1 } } [/cpp] I used to do the style that most people are using in this thread [cpp] void func() { } [/cpp] But Code Complete convinced me to change to my current style, I prefer it.[/QUOTE] Pure anti-me, lol. That makes my eyes bleed XD
[lua]- (void) foo:(int) bar { if ( foo == bar ) { [self foobar]; } }[/lua] [editline]10:49PM[/editline] dumb? that's OBJECTIVE-C YOU FUCKTARD.
[QUOTE=godihatefacepun;16739645]dumb? that's OBJECTIVE-C YOU FUCKTARD.[/QUOTE] Chill the fuck out, and Objective C is shit.
[IMG]http://imgkk.com/i/Yeycj1Hr.jpg[/IMG] (compwhizii) it's just C with some additional functionality
And? [editline]06:40PM[/editline] [QUOTE=godihatefacepun;16740425]-picture of me-(compwhizii)[/QUOTE] That doesn't leverage your argument any more.
[code] .MODEL Small .STACK 100h .DATA msg db 'Hello, world!$' .CODE start: mov ah, 09h lea dx, msg int 21h mov ax,4C00h int 21h end start [/code] I'm to cool for brackets.
Why would you program for DOS?
I heard it gives me more FPS than vista. Meh, I love to play whit old stuff.
[QUOTE=Baldr;16743228]I heard it gives me more FPS than vista.[/QUOTE] Sure, if you weren't running it in an emulator :V [QUOTE=Baldr;16743228]Meh, I love to play whit old stuff.[/QUOTE] How do you think I spotted it was a DOS program :3
[QUOTE=compwhizii;16742582]And? [editline]06:40PM[/editline] That doesn't leverage your argument any more.[/QUOTE] i dont think i need to bother arguing with someone who will never have kids unless they rape a chick
I still don't see how it relevant but w/e
with time your genes, which are pretty fail, will not stay in the gene pool and humanity will be spared. [highlight](User was banned for this post ("Trolling" - Dragon))[/highlight]
I stick the opening braces on the same line as the definition/declaration, although I've spaced them out on a new line when working with friends.
[cpp] void AwesomeFunction() { if(!Awesome){cout<<"make it awesome then\n";makeAwesome();cout<<"It is now awesome";} else{cout<<"it is awesome";} //but if I have complex ifs if(whattheshit) { //complex code here } } [/cpp] So there you have it.
[QUOTE=jA_cOp;16743265]How do you think I spotted it was a DOS program :3[/QUOTE] It makes me sad that there is no job that requires ASM knowledge in my country. :(
I like to keep my code compact, so white space is minimal. Opening brackets on the same line, usually two spaces per indentation level. I'll use tab instead if I'm using a text editor that doesn't like dual space indents. [cpp] void setup_ac() { /* Enable analog comparator interrupt; interrupt on toggle. */ ACSRA = (1 << ACIE); /* Enable 50mV hysteresis and set positive to AIN0 and negative to AIN1 */ ACSRB = (1 << HSEL) | (1 << HLEV); } [/cpp]
[QUOTE=ROBO_DONUT;16758918]I like to keep my code compact, so white space is minimal. Opening brackets on the same line, usually two spaces per indentation level. I'll use tab instead if I'm using a text editor that doesn't like dual space indents. [cpp] void setup_ac() { /* Enable analog comparator interrupt; interrupt on toggle. */ ACSRA = (1 << ACIE); /* Enable 50mV hysteresis and set positive to AIN0 and negative to AIN1 */ ACSRB = (1 << HSEL) | (1 << HLEV); } [/cpp][/QUOTE] Do you always use multiline comments unless the comment is after termination? Ex) /* Comment - Foo */ func(); // Line comment
[QUOTE=codebliss;16766566]Do you always use multiline comments unless the comment is after termination? Ex) /* Comment - Foo */ func(); // Line comment[/QUOTE] C++ style single-line comments only exist in C99.
Sorry, you need to Log In to post a reply to this thread.