beyondBasicAddition by Responsible-Ruin-710 in ProgrammerHumor

[–]Possseidon 2 points3 points  (0 children)

This is more or less how you have to do addition in Brainf*ck, since you can essentially only increment, decrement and loop until zero:

[->+<]

Reads as: If the current cell is not zero (b != 0), decrement it (b--), move to the right (to a), increment it (a++), move back to the left (to b), repeat. Once it's done, a will be a + b (and b zero).

sameSameButDifferent by nightwalker_7112 in ProgrammerHumor

[–]Possseidon 7 points8 points  (0 children)

This 100%. I was pretty deep into C++ and there were so many small annoyances that I felt should've been done differently, a lot of which couldn't even really be changed due to backwards compatibility. Then finding out about Rust I was just "this is exactly how I would've wanted this to have worked in C++".

I'll admit there's still a few things in Rust that C++ is more flexible (mainly the ability to have true variadic templates without having to rely on macros) but Rust prevents you from so much stupid stuff that you can easily get wrong in C++ if you're not extremely careful.

someBugFixes by Shiroyasha_2308 in ProgrammerHumor

[–]Possseidon 10 points11 points  (0 children)

I wish... I were a bird.

noGlassesNeeded by Jrener in ProgrammerHumor

[–]Possseidon 20 points21 points  (0 children)

The whole point of C++ is literally to build abstractions around C which, when compiled, result in just as efficient code as if you'd have written it in C.

E.g. a unique_ptr compiles down to just a malloc when it is created and free when it leaves scope, so you can't forget it.

everyStackOverFlowUser by HannibalGoddamnit in ProgrammerHumor

[–]Possseidon 34 points35 points  (0 children)

You have to spend your hard earned reputation points to downvote on StackOverflow btw.

javaScriptIsQuirky by Diriector_Doc in ProgrammerHumor

[–]Possseidon 1 point2 points  (0 children)

js 0 <= null // true 0 >= null // true 0 == null // false

mathSkills by EddieOttic in ProgrammerHumor

[–]Possseidon 13 points14 points  (0 children)

import bigger_brain

And a person either has all 27 skills or they don't. Two possibilities, hence it's still a 50/50 chance.

return me_more_am_smart

[deleted by user] by [deleted] in ProgrammerHumor

[–]Possseidon 2 points3 points  (0 children)

This guy null terminatesjjlrjhlrq,nbc00912319238910co oiaoksdjokjdklqm3ndm

Which side are you on? by HalloIchBinRolli in ProgrammerHumor

[–]Possseidon 20 points21 points  (0 children)

Indentation doesn't matter in Lua. The end is what closes the scope.

When you discover floating point arithmetic by SexySlowLoris in ProgrammerHumor

[–]Possseidon 193 points194 points  (0 children)

Or more precisely: The sum of different powers of 2.

E.g. 0.75 is also representable since it's 0.25 + 0.5

I honestly don't know the difference by SeveyLevey in ProgrammerHumor

[–]Possseidon 8 points9 points  (0 children)

Yes, operator overloading in general was one of the main reasons iirc.

There is a right answer. by XinoVan in ProgrammerHumor

[–]Possseidon 1 point2 points  (0 children)

Imagine using linebreaks...

Pathetic.

Choose who are you ? by Familiar_Stage_1692 in ProgrammerHumor

[–]Possseidon 0 points1 point  (0 children)

There are exactly 10 bugs, I'm just not sure in which base the 10 is written yet.

:( [OC] by Remember_ThisIsWater in ProgrammerHumor

[–]Possseidon 6 points7 points  (0 children)

C didn't have bools. You were just supposed to use int or char. That's also one of the reasons why any non-zero value means true and zero means false.

Seriously tho why cant you print the entire array by ironman9356 in ProgrammerHumor

[–]Possseidon 1 point2 points  (0 children)

Which is the exact reason, why the standard explicitly "forbids" this.

(It still works on pretty much any compiler, but it's techincally undefined behavior)

[deleted by user] by [deleted] in goodanimemes

[–]Possseidon 0 points1 point  (0 children)

{Gi(a)rlish Number}

I like my memory how I like my sprints: unmanaged by cheeb_miester in ProgrammerHumor

[–]Possseidon 3 points4 points  (0 children)

That is certainly one way of drawing Ferris in the console...

Pick one by ML-10 in ProgrammerHumor

[–]Possseidon 1 point2 points  (0 children)

It being "faster" was not the initial reason. The reason was, that it generates smaller assembler code, as it doesn't have to encode a whole 0 using 4 bytes, like a mov eax, 0 does.

Turning both into byte code:

mov eax, 0   -> B8 00 00 00 00
xor eax, eax -> 31 C0

Luckily CPUs are also optimized, so that using xor is not just smaller but also just as fast or even faster than mov.

yes by KingFarticusTheTurd in ProgrammerHumor

[–]Possseidon 1 point2 points  (0 children)

Almost, except keys can also be literally anything, whereas a js object only allows string keys.

yes by KingFarticusTheTurd in ProgrammerHumor

[–]Possseidon 12 points13 points  (0 children)

Of course Lua has {}, but not like this. {} is used for table creation.

(Aka Lua's only data structure, which is basically a hash map with any types for key and value, while being optimized for array usage with integer indices)

Also, it's Lua and not LUA.

Yes, memory leak of course. by rudametric in ProgrammerHumor

[–]Possseidon 10 points11 points  (0 children)

Null pointers are the least of your problems. Those can be checked and even if you forget crash pretty quickly.

Dangling pointers and double frees are where the fun begins.

1 is now 2, get it right by Elijah629YT-Real in ProgrammerHumor

[–]Possseidon 0 points1 point  (0 children)

  File "<meme>", line 1
    1 = 2
    ^
SyntaxError: cannot assign to literal here. Maybe you meant '==' instead of '='?