moose-mousse - Electronic Moose
Electronic Moose

Helloooo! I am Moose! They/Them/He/Him I am a embedded software engineer with autism, depression and anxiaty ( Wooo! ). I post about... whatever I want... software things, mental health things... whatever I feel like Feel very wellcome to send me asks about... anything that strikes your fancy :3

266 posts

That Is A Very Good Point. I Absolutely Agree!

That is a very good point. I absolutely agree!

(Nearly) Never use auto in C++!!!

So I used to be amongst the people who thought "Yeah ok, auto hides the type. But if the type is not really important to understand the code, and was really long and confusing then it is worth it"

Like this: std::vector<std::pair<std::string, Employee>> MyFunction(); To turn it into: auto MyFunction();

And I was wrong. Do NOT use auto to hide that monstrosity. You FIX it. auto hides that awful thing and dumps the problem on the next poor fucker who will use it. ( People writing and using metaprogramming libraries are especially prone to doing this, since their typenames can fill entire screens ).

YOU just looked at YOUR code. Found it confusing... And decided... to HIDE it??? What it is the next person who did NOT write this code going to do when they read this going to do???

No. I beg of you. Use typedef.

You can create aliases of anything and make your code easy to read. And this only "hides" the code as much as auto and you can get the types the alias points to by musing over it. So it is auto... but way better. Because it is a UNIQUE name. Which can DESCRIBE things.

Like, with the horror in the previous example. Let us have a typedef in the .hpp file where "MyFunction" is declared. Now it reads MUCH better:

std::vector<std::pair< Employee_ID, Employee>> MyFunction();

I actually understand what the pair is now! Key value pairs! And screw it. Let us typedef the pair too now that we understand it!

std::vector<Employee_KeyValuePair> MyFunction();

And fuck it. Once more! Typedef the vector too!

Employee_Roster MyFunction();

I will bet most of you reading this only realized what the hell that moster was when you got near the end. BECAUSE THE FIRST THING IS FREAKING UNREADABLE! Fix it. Make your code readable. If you feel the urge to use an auto to hide a typename, it is time to typedef that motherfucker!

  • trishfishseven
    trishfishseven liked this · 8 months ago
  • steve-cat
    steve-cat liked this · 8 months ago
  • rorschach-black
    rorschach-black liked this · 10 months ago
  • nikki-blogging
    nikki-blogging liked this · 1 year ago
  • lidge-soup
    lidge-soup liked this · 1 year ago
  • sweetpoetrygladiator
    sweetpoetrygladiator liked this · 1 year ago
  • darlingvagary
    darlingvagary liked this · 1 year ago
  • apotheologie
    apotheologie liked this · 1 year ago
  • colorfulcollectorpirate
    colorfulcollectorpirate liked this · 1 year ago
  • ryuji-terix
    ryuji-terix reblogged this · 1 year ago
  • bovid-beauty
    bovid-beauty liked this · 1 year ago
  • stuck-in-unova
    stuck-in-unova liked this · 1 year ago
  • jolene757
    jolene757 liked this · 1 year ago
  • captaintarin
    captaintarin liked this · 1 year ago
  • green-mountain-goose
    green-mountain-goose liked this · 1 year ago
  • cyberfolktale
    cyberfolktale liked this · 1 year ago
  • quirkyplutonian
    quirkyplutonian liked this · 1 year ago
  • liiht
    liiht reblogged this · 1 year ago
  • growtiredofpublicvulnerability
    growtiredofpublicvulnerability liked this · 1 year ago
  • magnolea
    magnolea liked this · 1 year ago
  • deadstrides
    deadstrides liked this · 1 year ago
  • hayacode
    hayacode liked this · 1 year ago
  • quietmarie
    quietmarie liked this · 1 year ago
  • wolfmestize
    wolfmestize liked this · 1 year ago
  • zukulini
    zukulini reblogged this · 1 year ago
  • zukulini
    zukulini liked this · 1 year ago
  • brudiza-spudnik
    brudiza-spudnik liked this · 1 year ago
  • velvettroupe
    velvettroupe reblogged this · 1 year ago
  • velvettroupe
    velvettroupe liked this · 1 year ago
  • genderfluid-dynamics
    genderfluid-dynamics liked this · 1 year ago
  • dessometrics
    dessometrics liked this · 1 year ago
  • lady-inkyrius
    lady-inkyrius reblogged this · 1 year ago
  • lady-inkyrius
    lady-inkyrius liked this · 1 year ago
  • dabub167
    dabub167 liked this · 1 year ago
  • kodicraft
    kodicraft reblogged this · 1 year ago
  • i-love-linux-and-reject-gender
    i-love-linux-and-reject-gender reblogged this · 1 year ago
  • yourlocalnerd07
    yourlocalnerd07 reblogged this · 1 year ago
  • nourhanlwt
    nourhanlwt reblogged this · 1 year ago
  • nourhanlwt
    nourhanlwt liked this · 1 year ago
  • lljramirez
    lljramirez liked this · 1 year ago

More Posts from Moose-mousse

1 year ago

"Hammers head into "Decline to Self-Identify""

I COULD answer "Male" because I am not trans ( Partners are though) and I will NEVER do so when any version of "Fuck off, that is no business of yours" option exists.

There is 2 things a company can do with that information. Nothing, and illegal discrimination things.

And I will do my own small part to make the information as useless as possible. Otherwise "Decline to identify" easily becomes the "Trans people out yourself so we can discriminate against you" button

Folks, It Has Happened Again On Another Job I Applied For.

Folks, it has happened again on another job I applied for.

1 year ago

You made me wake my dog up from laughter! :D

programmers will complain about how C++ is too complicated or arcane or whatever and then will literally go and write in JavaScript

1 year ago

What's your favourite fact?

Don't really have many favorite things.

But I will tell you the best one I can think of right now:

"Human eyeballs are all the exact same size. "

Now. In fact, they grow a little bit ra little while after birth. And "Exactly the same size" means "Within 1-2mm" but I think it counts.

Why do I know that fact? Because I make robots. And robots can get the distance to something on the camera IF they know the true size of an object next to the target.

And eyes are quite easy to spot with peogramming. So robots use all the human eyeballs to constantly calibrate their distance measurements.

Now THAT is a neat fact!


Tags :
1 year ago

I... I feel like I am getting diabetes by reading this post!

It is SO sweet and positive and wonderful and just... "chef's kiss"

✧・゚: Customize your highlight color! :・゚✧

: Customize Your Highlight Color! :

I recently came across a blog where when I went to highlight some text I noticed it was a unique color!!! (」°ロ°)」

AND IT'S SO SIMPLE TO DO

all you do is go to your css file and add this:

::selection { background: <hexcolor> }

Enjoy!! ♡⸜(˶˃ ᵕ ˂˶)⸝♡

1 year ago

Denmark... is a elitist, right wing country

( Trigger warning, if you do not wish to hear about my political posts, blacklists the tag Danish Politics") So I am a Dane. And weirdly enough for my atheist, polyamorous self, I actually do want to be proud of my nation. And I AM, of several things Denmark have done... But overall? No. Denmark have widespread corruption ( A test in the spring of 2023 of "Who is willing to take bribes if we offer them 50k DKK (About 7.5k USD)" had 91% of politicians in parliament saying yes please) but a lot of the success of Denmark is based on what people THINK of Denmark, rather than what it actually is. For example, I finished university currently. And not only did the Uni teach students a way of doing databases that was in direct breach of GDPR (I documented this, and still have it all, since at the end of my education, I did not trust the university at all), but in at least 4 classes, the teacher did not bother to define what the students had to do to pass. In my robotics class, our final papers definition was "It must be 5 pages". That was it. No topic, no focus, no anything. You could still fail, but the requirements was inside a professors head, and you had to guess. If you ask the universities they will tell you that they received basically no complains. They forget to mention that there is no way TO complain. Despite this completely incompetent behavior, people having a danish education is thought of as high level. Because we used to be. Basically anything good you hear of Denmark, is inertia from its behavior in the 1990s (30+ years ago). Today it is a corrupt, right wing extremist state like so many other disappointments. We still have rights, but they are getting removed. And the majority of Danes do not care. They are busy yelling their sympathies to Israel.


Tags :