Why do you use curly braces on a new line after the function statement but not after if or for?
Aiden Robinson
Reminder op is a retard void function() { /* ... */ if() { /* ... */ } while(a[--x] = x) ; }
Jayden Lopez
I prefer braces on their own line. That way in cases like below, the braces are consistent. Otherwise it's a bit confusing which is the statement that's run and which is part of the if statement.
if (reallyLongConditional.hasSomeLongValue() && reallyLongConditional.hasSomeOtherLongValue()) { /* ... */ }
// vs
if (reallyLongConditional.hasSomeLongValue() && reallyLongConditional.hasSomeOtherLongValue()) { doSomething(); }
Zachary Lewis
Well done, but that wasn't the point
Brayden Allen
that's how you tag a codeblock in markdown, the cpp after it was supposed to denote c++ syntax highlighting
>You weren't well taught and appear to be acting like a retard! >writes a default int
Oliver Howard
ahem! void function() { /* ... */ if(test) { /* ... */ } for (int i = 0; i < n; i++) { a[i] = i; } }
Isaac Ross
silly redditnigger
Jose Rodriguez
Listen to OP.
Here, let me spell it out clear as fuck:
WHEN YOU FUCKING ALIGN THEM IN THE SAME COLUMN IT MAKES THE CODE EASIER TO READ, DEBUG, AND FOLLOW BECAUSE YOU CAN FUCKING SEE WHERE BLOCKS BEGIN AND END A FUCK LOT EASIER. SO FUCKING DO IT, YOU GODDAMN JERKOFFS, AND IF SOME SMARTASS TEACHER/BOSS/OTHER IDIOT TELLS YOU TO DO IT DIFFERENTLY, TELL THEM WHAT I TOLD YOU, AND THERE IS NO OTHER LEGITIMATE WAY TO DO IT.
End of fucking argument and discussion.
William Collins
OP is a fag and managed to get it exactly backwards. Well done.
Also, "people" who leave out the braces on for loops should probably just die.
Grayson Nguyen
#include
int main() { int x=0; if(x
Juan Collins
The only reason why there is brackets and semicolons is that you can put everything on one line.
Luis Adams
>reddit github comments pages and readmes use markdown
Matthew Harris
Nice infinite loop and complete misunderstanding of printf's syntax
Lucas Lewis
>omitting for loop braces I would hang you from a tree.
Jayden Price
Rate my code? pastebin.com/sTQFMsxY I should have used bitmask in the if statement...
Superior (define (function) (when () ...) (for ([i (in-range x)]) (vector-set! a i i)))
Jaxon Martinez
Why do you even write comments nigger? If you're going to use a font like that do have stealth comments that no one can read, don't even bother in the first place.
99% of zoomer syntax highligthing themes have this retarded invisible comment crap.
Hunter Johnson
And actually some comments you can avoid // 3 milli-second timeout
#define POLL_TIMEOUT_MS 3
There, now you don't even need a comment anymore to explain where the 3 comes from, and there is no risk that the comment goes out of sync with the actual value (which could happen if someone does not see your stupid stealth comment).
Jack Cruz
Also this...
int ERR = ERRno STDERR ERR ERR STRERROR ERR
Thanks for the comment above this code to remind me that it's error handling, i would have had no clue otherwise.
Comments are for explaining non-obvious stuff.
Jordan Parker
Good points.
Jaxon Jones
I unironically used to write the 2nd way when I learned how to program until I copied my teachers who were writing the 1st way.
Jason Peterson
I didn't understand what you just said.
Nathaniel Robinson
all our indian coders think they get paid by the line so their code ends up looking like a fucking shel silverstien poem but also everything is shitty and wrong. god damn diploma mills.
Carson Turner
silly githubnigger
Austin Collins
It just looks weird in languages that use begin/end instead
if(a == 16'd1) begin end
Chase Lee
this thread just convinced me I'm too retarded for this major and should switch to chemistry or just live on a farm as a hermit until I kill myself
The point of the comment is you don't even have to look at that block if you don't care about error handling. Maybe a bit much given it's only 3 LOC, but for larger pieces of code, that sort of thing is nice.
Ian Gonzalez
style guide you faggot
Hunter Ward
comply with the project's formatting guide instead of being a flaming faggot
Brandon Jenkins
>redditmark
Andrew Foster
Different languages do it differently. Follow the coding convention of the current using language.
Camden Wood
#define begin { #define then { #define do { #define end } #define
Jaxson Jones
If you don't enclose all if bodies with braces, you have already lost
Ian Hall
In the case of one-liners, I find if (cond) inst; less error prone than if (cond) inst;
while still being less of a waste than using braces. Line break and braces for multi-line block.
Chase Ross
Braces are quickly added while writing the if statement, but an annoyance if you want to add a second statement later on. But yeah, if you insist on not using braces, go for one line.
Caleb Martinez
Damn That isn't how I was taught I feel like a fool
Leo Ward
Markdown is a thing that exists by itself outside of any websites. Markdown nigger would be appropriate, but there really is nothing wrong with markdown.
Jeremiah Edwards
>no closing tag for the foor loop >trying to define
Isaiah Peterson
won't #define do { fuck up with do ... while?
Maybe you should use these macros? #define IF if( #define THEN ){ #define ELSE } else { #define ELIF } else if ( #define FI ;}
#define BEGIN { #define END } #define SWITCH switch( #define IN ){ #define ENDSW } #define FOR for( #define WHILE while( #define DO ){ #define OD ;} #define REP do{ #define PER }while( #define DONE ); #define LOOP for(;;){ #define POOL }
Gabriel Watson
This looks like a good set of preprocessor definitions but I feel that putting a gun to your head and pulling trigger will do a better job.
Alexander Anderson
There is no style in writing C.
Mason Rivera
>a[--x] = x that's undefined behaviour, son. read up on sequence points.
Actually, the objectively superior style is void function() { /* ... */ if() { /* ... */ } for(i = 0; i < x; i++) { a[i] = i; } }
Charles Perez
Source?
Blake Diaz
This doesn't loop at all. It is wrong on many levels.
Carter Roberts
Both of those are fucking disgusting.
Noah Lopez
int fuckyou(virginOP, chadMe){ int toreddit = 1 if(virginOP < chadMe){ //always resolves to true toreddit = gay() } for(int fag = 0; i < 10; i++){ toreddit = niggers() } return toreddit; }
Evan Lewis
The absolute pajeet coder.
Adam Ward
You're fired
Elijah Jones
FRIENDLY REMINDER: SOFTWARE ANTI-PATTERNS ARE YOUR FRIENDS, NOT YOUR ENEMIES. IF YOU'RE THE ONLY PERSON WHO CAN READ YOUR OBSCURE AND OBFUSCATED NESTED RECURSIVE FUNCTIONS, THEN YOU ARE MUCH MORE SAFE-GUARDED AGAINST DOWNSIZING AND LAY-OFFS BECAUSE YOU'RE THE ONLY PERSON HO UNDERSTANDS THE CODEBASE.
CLEAN CODE === EASILY REPLACED EMPLOYEE
Andrew Jackson
undeniably based and red pilled
Owen Wood
Genius line of thinking actually. Clean code makes you interchangeable as they're likely to perceive you as just another Programmer Worker Unit. I will remember this.
No, tcl requires that the opening brace appear on the first line (unless you use \), so one should do the same in C as well. Also, whitespace is a meme for people who can't code to feel accomplished via style points. Train yourself to see in phrases and delimiters, not character by character.
Leo Long
You only think that because you were told that. It's not true at all.
Owen Long
You're not doing it right either, and you look like a fucking retard. Here, let me fix that for you. void function() { // ... if () { // ... }
for (size_t i = 0; i < x; i++) { a[i] = i; } }
Michael Parker
not a loop at all, just an if() statement
nothing wrong with the printf syntax
$ gcc -o g g.c $ ./g x is 0
Camden Murphy
Imagine unironically caring this much about what line someone puts an opening bracket on
Ethan Nelson
>putting { on next line People like you must die It makes code unreadable
Tyler Hughes
This
Egyptian braces for all things.
Asher Roberts
Stroustrup go home
Chase Wood
Those gorillas are based
Brayden Baker
If you coded like this my professor would literally fail you with 0 points until you learned to not be a gorilla nigger.