[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vr / w / wg] [i / ic] [r9k / s4s / vip / qa] [cm / hm / lgbt / y] [3 / aco / adv / an / asp / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / qst / sci / soc / sp / tg / toy / trv / tv / vp / wsg / wsr / x] [Settings] [Home]
Board
Settings Home
/g/ - Technology



Thread archived.
You cannot reply anymore.



File: image.jpg (7 KB, 424x293)
7 KB
7 KB JPG
.
>>
>>63317478
nice thread idiot
sage
>>
>>63317478
Another 9gag meme
>>
True patricians only.
match cond {
true => {

},

false => {

}
}
>>
(condition)?(true):(false)
one true ruler of them all
>>
>>63317478
if(condition){Statements; /**      **/}
>>
stop it get some help
you stupid fuck
>>
File: 198979.jpg (62 KB, 800x617)
62 KB
62 KB JPG
>>63317478
who gives a fuck?i always use the first one(except when i program in java) because i like seeing code in blocks,but if you prefer the second one thats fine too.just use one of these and you are good.
>>
>>63317478
Left is c/c++
Right is java
>>
>>63317478
follow the project guideline.
if no guideline, use whatever is used in the official doc.
Everything else is retarded.
>>
if(succ)
{
wewlad
}
>>
>>63317478
>9gag
>>
>>63319927
LLVM uses the one on the right.
>>
>>63319927
It's literally the reverse.
>>
#DEFINE BEGIN {
#DEFINE END }
#DEFINE IF if(
#DEFINE THEN )
//etc
>>
>>63317478
I use both.
>>
>>63320501
wat
>>
>>63317478
Whole condition goes on one line.
>>
>>63320667
If I'm not mistaken, he's using C preprocessor instructions so he can write C programs in a Fortran style.
>>
File: 1509674038165.jpg (21 KB, 342x360)
21 KB
21 KB JPG
>>63317478
} elseif {


Why do people do this? It looks like shit.
>>
File: shg.png (242 B, 378x378)
242 B
242 B PNG
>>63317478
>>63317528
>>63317564
>>63317568
>>63317623
>>63317686
>>63317790
>>63317804
>>63319927
>>63319954
>>63319986
>>63320016
>>63320030
>>63320501
>>63320659
>>63320667
>>63320715
> instead of actual programming topics, /g/ spends all day bikeshedding on the most simple of code style choices
Stay nĂ¼, /g/
Tomorrow's srsbsns topic: tabs or spaces

>>63319672
>>63319951
Only sane answers
>>
>>63320748
No one on /g/ actually programs.
>>
(define (fag-check OP)
(if (= OP fag)
(display "OP is a faggot")
(display "OP is a pretty cool guy")))
>>
>>63320773
ternary masterace

???????????????????????'
>>
>>63317623
>(condition)?(true):(false)
FTFY:
(condition)
>>
>>63320748
>replying to my obvious baitpost
>>
File: only pretending.png (2 KB, 244x226)
2 KB
2 KB PNG
>>63321009
A thread still died for this
>>
>>63317478
>9gag picture
>retarded *** will know meme
>facebook tier humor
>barely readable because retarded meme is save/uploaded by retarded people so the jpeg compression artifacts pile up
nigger what are you doing? Sage in all fields
>>
left for work

right for personal
>>
>>63320030
Nah. Java ides are always forcing the right while c++ reference prefers left
>>
The correct style is the style that my lead developer picked.
>>
>>63320745
weird way of spelling awesome
>>
File: Screenshot.png (26 KB, 738x432)
26 KB
26 KB PNG
>>63320748
all me
>>
left: programmers
right: coders/koders

prove me wrong
>>
the thinking mans choice

#include <stdio.h>
int main(){printf("asdf\n");}
>>
>>63321398
*evidence against you are claim*
>>
>>63321442
insightful
>>
>>63321457
for an insightful original point
>>
>>63317478
so declarative and python fags aren't people.
right.
>>
>>63321469
wow thanks i tried hard
>>
File: pyjava.jpg (58 KB, 585x550)
58 KB
58 KB JPG
>>
>>63321502
This looks cool, actually.
>>
>>63321502
Only sane braces out there
>>
>>63321502
>type one line slightly past wall of punctuation
>have to reformat entire file so they all line up again
>>
>>63321627
not a problem if you stick to 80 chars like you should
>>
vaguely better

(define (fag-check OP)
(display (if (= OP fag)
"OP is a faggot"
"OP is a pretty cool guy")))


somewhat better

(define (fag-check OP)
(display
(string-append "OP is a "
(if (= OP fag)
"faggot"
"pretty cool guy"))))


or in CL

(defun fag-check (OP)
(format t "OP is a ~:[pretty cool guy~;faggot~]") (= OP fag)))


heh
>>
if condition:
statements
>>
>>63321759
good work anon
you're the hero this thread needs
>>
mari > asuka > rei
>>
>>63321721

(defun fag-check (OP)
(format t "OP is a ~:[pretty cool guy~;faggot~]" (= OP fag)))


fixed
>>
>>63320763
>No one on /g/ actually programs.
well, it's not actually a programming board to be fair.
>>
>>63321716
apart from the fact that its java and has class names longer than that
>>
>>63321502
This is why I like python so much. They had the balls to drop that punctuation nonsense
But otoh they made this whole .self hell
>>
This is the correct way to do it brainlets
    if ("true".equals(String.valueOf(condition))) {
/* .. Statements */
} else if ("false".equals(String.valueOf(condition))){
/* .. Statements */
} else {
throw new Exception("The condition is not true nor false!");
}
>>
>>63322630
this is some high level high leveling
>>
File: AR vs AK.jpg (100 KB, 720x540)
100 KB
100 KB JPG
>>
If (!(OP != faggot)) {
btfo = printf("ban OP");

return btfo;
>>
>>63321378
what the fuck
>>
>>63322630
>not choosing a code path randomly
I can smell you from here pajeet
>>
>>63317478
If you dont use the terniary operator for everything you are a waste of oxigen
>>
File: concern.png (152 KB, 444x480)
152 KB
152 KB PNG
>>63317478
condition ? trueCallback() : falseCallback()
>>
>>63317478
cmp eax, ebx
je true
mov eax, s_knowwhatop
jmp aftercond
true:
mov eax, s_yourgay
aftercond:
int 3
>>
>>63324989
inspect element
>>
giving the { its own dedicated line makes no sense since there is already an indentation
>>
>FECES CUM
>>
>>63329077
It provides extra clarity and makes it easier to discern a codeblock when speed scrolling. Readability is everything.

When I was a beginner, I used to be a huge fan of K&R, but as I got better, have completely switched to Allman's indentation style

if (a=e||a>d) {
a=b>d?c:f
f=a<b?d:c
asdasdasd
}

if (a=e||a>d)
{
a=b>d?c:f
f=a<b?d:c
asdasdasd
}

That extra space is almost like a breath of fresh air.




Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.