[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]

wtf C#

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: 64
Thread images: 3

File: Capture.png (3KB, 362x94px) Image search: [Google]
Capture.png
3KB, 362x94px
wtf C#
>>
>>52397387
dim boolOpIsAFag = True;
>>
op cant cast
>faggot
>>
>>52397428
I know the problem and solution, the thing is that I don't want to write more than necessary.

while(1) is infinitely better than while(true)
>>
>>52397448
autism
>>
>>52397467
You are on /g/, why are you here if you don't have autism
>>
>>52397448
>not using
#define forever for(;;)
>>
While<TAB><TAB>

Problem solved
>>
>>52397387
>C#
Maybe you should learn a real language like C?
>inb4 FUCKING JAVA I HATE JAVA SO MUCH FUCKING JAVAFAGS
>>
A number is not a boolean. Sorry to hear you're stuck in the C mindset.
>>
>>52397680
I bet you think strings aren't numbers either
>>
>>52397680
Just about every language can convert a number to a boolean as long as its 0 or 1.
>>
>>52397698
Strings should be treated as primitives. Enjoy your overflows.
>>
>>52397705
It doesn't make sense to convert an integer into a boolean value. That's what C autism brought us.
>>
while ( (1 > 0) && (-1 < 0) && (0 == 0) ) // just to be sure, you never know
>>
>>52397729
well memed sir.
>>
>>52397642
>not using
boolean ever = true;
for(;ever;)
>>
>>52397766
bool _ = true;
for( ;_; )
>>
OP, here's one that'll always be true

while(OPisaFag)
>>
>>52397642
>>52397766
>>52397781
>can't into semantics
#define forever while(true)
do {
//stuff
} forever
>>
>>52397448
>thinking using an integer in place of a boolean and magically expecting the computer to semantically know what you mean is "better"
You are the cancer that is killing programming. Go back to your javascript, retard.
>>
>>52397853
true is literally just 1 in the RAM. It's not magic to expect a programming language to understand that 1=1
>>
>>52397448
how does while(1) make sense

While 1 what?

what do I do with the 1

If while(1) is ok, what about while(15)
>>
>>52397678
>C
>real language
Pick one and only one.
>>
>>52397678
>>inb4 FUCKING JAVA I HATE JAVA SO MUCH FUCKING JAVAFAGS
why so buttblasted
>>
>>52397387
fuck off with your retarded type castings

that's what people start from to reach the point of complaining why their FrameBuffer object isn't automatically casted to a fucking vector array.
Literally fuck off.
>>
>>52397860
You don't think of 1 as a number, you think of it as an alias for 1. Or more correctly, you think of true as an alias for 1.
>>
>all these web fags not knowing that every value except 0 is true
>>
>>52397859
>confusing semantic meaning with implementation details
What if I told you that there exists commonly used languages where True is 0?
>>
>not using goto for loops

loop:
printf("fucking plebs\n");
goto loop;
>>
>>52397938
More like:
<<Loop_Label>>
Put_Line("fucking plebs");
goto Loop_Label;
>>
>>52397448
>I don't want to write more than necessary.
>makes a thread about it
k.
>>
>>52397860
hmm, lets see.
The while loops keeps executing what is inside the loop WHILE the expression in brackets after the while keyword evaluates to true (I.E. 1).
Figure the rest out yourself you fucking idiot.
>>
>>52397894
>You don't think of 1 as a number
yes you do. unless you '(bool)1'
also, writing 'true' instead of '1' takes 3 extra characters, OP wont die from it, lazyfuk

2/10 made me reply
>>
>>52398005
but 1 != true

1 = 1

true = true

1 != true
>>
>>52398005
But neither 1 nor 15 evaluate to True. Checkmate, atheists.
>>
>>52397729
Incase you didn't notice, a boolean is LITERALLY an integer.
It just (theoretically) has a range of 0 to 1, instead of say 0 to 2^64-1.
In reality, booleans are implemented as either a byte or word.
>>
>>52398019
But 1 does = true
>>
File: 2016-01-13_13-16-02.png (3KB, 155x108px) Image search: [Google]
2016-01-13_13-16-02.png
3KB, 155x108px
>>52398005
Ain't that some shit
>>
>>52398044
not in c#
>>
>>52397781
Alright, I laughed at this one
>>
>>52398046
>1=true
not
>1==true
newbie detected
>>
>>52397387
I ran into this problem this week while writing an expression parser. Had to do some bullshit "value == 0 ? false : true" fuckwittery to get it working.
>>
File: 2016-01-13_13-18-04.png (2KB, 295x52px) Image search: [Google]
2016-01-13_13-18-04.png
2KB, 295x52px
>>52398055
Ain't that some shit: the preque

This was the first thing I tried
>>
>>52398019
Except true does equal 1.

>>52398024
1, 15, and every other number that isn't 0 evaluates to true.

>>52398046
This is bait.
>>
>>52398035
But that doesn't mean the programming language should allow boolean to integer conversion.
>>
>>52398035
>a boolean is LITERALLY an integer
lolnope, check the operations
>booleans are implemented as either a byte or word
again, lolnope, unless you have a shitty compiler
>>
>>52398071
It definitely should.
Why would you want to make life harder by placing fucking retarded restrictions like that?
>>
>>52398069
See >>52397910 you weakly typed tard.
>>
Why not while(00000001)
>>
>>52398077
Because it's bad practice.
>>
>>52398073
So how does your oh so great compiler do it huh?
The only compilers i use are GCC and Clang.
It's not like you can address single bits like you can bytes, so your compiler must be doing some shitty bit hacking that only works well if you have 8 or more booleans, in which case, your compiler is utter garbage.
What if you needed to pass a pointer to individual boolean values huh? what's your compiler gonna do then? you can't rely on your bit hacks anymore.
>>
Why not
while(God exist)
>>
>>52398130
we already have while(false) though
>>
>>52398077
To make it easy to detect errors where you put values of one type where you really meant to put values of another type. Duh.

(Yeah, I know this entire thread is a troll thread by some idiot who cannot into programming, but dammit, I'm bored.)
>>
>>52398130
I'm not gonna exist forever
Then the code would no longer run
>>
>>52398126
Let me introduce you to this little thing:
https://en.wikibooks.org/wiki/Ada_Programming/Pragmas/Pack
>>
>>52398130
actually,regarding /g/, its better
while(anon==virgin)
>>
It's so aggravating when you something is done in retarded way because of these reasons.
>readability
>bad practices
The end result is language like go where you can't do anything and everything is so verbose you lose all the readability.
>>
>>52398186
>while(true) is so verbose, like omg
>>
>>52398186
Do you like undefined behavior?
>>
>>52398169
Yes, those are generally bitfields, that is exactly what i was talking about in my post you idiot, you think I don't know about packing and bitfields?
But as i said, that's a shitty way to do it, seriously.
It's better performance wise to store booleans in the machines native word size.
Having to do fucking bit operations to retrieve and store a value is slow and unacceptable.
Atleast Ada seems to have this as an optional attribute.
Any compiler that forces this is utter garbage though.

A bitfield is only acceptable in large arrays so that the increased cache locality outweighs the bitwise ops penalty.
>>
>>52398268
I expect a major use of it is in embedded programming, where memory space may be at a premium. But the original point was that booleans can and are implemented in other ways than bytes/words.
>>
>>52398308
Okay, point taken.
Thread posts: 64
Thread images: 3


[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.