[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Hey /g/ do you have your constant on the left or right? such

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 15
Thread images: 2

Hey /g/ do you have your constant on the left or right? such as

if 5 == whatever()
OR
if whatever() == 5

http://www.strawpoll.me/11801709
>>
lefts for autists
>>
File: print.png (4KB, 1068x34px) Image search: [Google]
print.png
4KB, 1068x34px
>>57845072
right, it's much more readable and logical even though they're the same
>>
>>57845072
On the right. Otherwise, it's inverting "if x is 5 ..." for no good reason.

>>57845089
"IF FIVE IS X" is indeed high autistry.
>>
>>57845072

is this a serious question?
>>
Left guarantees not accidentally using the assignment operator.

Right is more readable.

I generally tend to put it on the right.
>>
>>57845072
that's a literal not a constant faggot
>>
>>57845072
You actually scanned this disk for 22 days?

As for the question, putting rvalues on the left will save you from "= instead of ==" errors slipping by only to be discovered hours later.
>>
>>57846058
Depends on the what the actual language is. Most people seem to miss this, but in pure C the only literals are string literals, everything else that's called a literal in, say, C++ is a constant in C. It can get confusing because people often also refer to const variables or preprocessor macros (such as "#define FOO 42" as "constants".
>>
>>57845072
if you do it the way
> if 5 == shit
you get an error if you accidentally write
> if 5 = shit

thats nice.
>>
Yoda conditionals.
>>
>>57845072
>1TB disk
>0.5 MB/sec
>Elapsed Time 5:33
>Damaged Blocks 100%
seems legit and not photoshoped at all
>>
>>57847152
c has array literals of every kind in c99, i think
>>
Constant on the left is for old AT&T assemblyfags
>>
>>57845072
>having it on the left

I never even imagined such high autistery, have anyone seen this in rl?
Thread posts: 15
Thread images: 2


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
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.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.