There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

programmer_humor

This magazine is from a federated server and may be incomplete. Browse more on the original instance.

Varyk , in Up up and away we go

I definitely do this with terminal commands, because I’m not hunting for whatever the specific command line to animate my gif wallpaper is.

fuzzy_feeling ,

been there, done that.

then i heard about cli snippet manager. now i use qownnotes snippet manager qc. or you might try pet.

Varyk ,

did you know about the ctrl+r command so you can search logged commands by keyword!

magic lobster party told me about it and it’s amazing!

I had no idea that was a function until now.

magic_lobster_party ,

Ctrl + R is a life changer.

Varyk ,

HOLY SHIT.

hahahaha, thank you. oh my gosh.

This is the most significant turmoil hotkey I’ve learned in months.

♪⁠┌⁠|⁠∵⁠|⁠┘⁠♪

dejected_warp_core ,

Upvoted for the dancing and singing emoticon. Nice art.

Varyk , (edited )

Thanks, someone told me how to acess the old-school emotiocns recently and i like them.

I Like THEM!

(⁠ノ⁠°⁠_⁠o⁠)⁠ノ⁠⌒⁠┫⁠ ⁠┻⁠ ⁠┣⁠ ⁠┳

7uWqKj , in `0x0d2C` – Ode to C

This is older than many reading here … and C was already old when this was written.

7uWqKj ,

Or should I say, when this was posted on Usenet. Who knows when it was written.

dactylotheca OP ,
@dactylotheca@suppo.fi avatar

The Usenet post I linked to claims it’s originally from the 1st quarter of 1990, but who knows if that’s accurate or not. I actually can’t find a good source for whether Stumpf is the original author or just the one who posted it to rec.humor.funny.reruns, but it’s usually attributed to him at any rate.

But yeah, fairly ancient by internet standards. I remember first running into it in the 90’s

urda , in This is my life now, until I finally understand Cmake.
@urda@lebowski.social avatar

I’m in this photo and I don’t like it

nexussapphire , in This is my life now, until I finally understand Cmake.

I forgot to assign a variable, now it crashes %5 of the time. It’s wild how c doesn’t default variables to null or something.

Endmaker ,

default variables to null or something

That is such a bad idea. Better to have the compiler warn you about it like in Rust, or have the linter / IDE highlight it.

nexussapphire ,

If it’s going to compile without any warnings I’d rather the app crash rather than continue execution with rogue values as it does now.

There is so much room for things like corrupted files or undocumented behavior until it crashes. Without the compiler babysitting you it’s a lot easier to find broken variables when they don’t point to garbage.

zaphod ,

Just enable all compiler warnings (and disable the ones you don’t care about), a good C compiler can tell you about using unassigned variables.

nexussapphire , (edited )

Still learning, they just covered compiler flags in cs. They didn’t go into detail yet though.

Edit: I’ve used python for years and they have something equally dumb. You can have a function in a massive application that is broken and the moment it’s called, the application crashes.

At any other point the application will just run as if nothing is wrong even though python evaluates everything at runtime. I’m sure they can’t do much because the initial launch would be slow.

CodeMonkey ,

C does exactly what you tell it, no more. Why waste cycles setting a variable to a zero state when a correct program will set it to whatever initial state it expects? It is not user friendly, but it is performant.

marcos ,

Except that this is wrong. C is free to do all kinds of things you didn’t ask it to, and will often initialize your variables without you writing it.

nexussapphire ,

Machine code would be a better example of what he’s talking about imo. Not an expert or anything of course.

marcos ,

Odds are that your computer doesn’t export any language where it will do exactly as you say (amd64 machine code certainly won’t execute exactly as written). And how much difference it makes varies from one language to another.

But the specific example from the OP, of uninitialized variables, is one of those cases where the C spec famously goes completely out of line and says your code can do whatever, run with a random value, fail, initialize it, format your hard drive, make a transaction on your bank account… whatever.

Hack3900 ,

Coding in C but if I don’t initialize a Variable the compiler formats my drive! (Not Clickbait)

nexussapphire ,

It wouldn’t be that much processing compared to the rest of the app. It would lot more efficient than running an effectively infinite loop or arithmetic on an arbitrarily large number as a result of an unsigned variables.

lung , in This is my life now, until I finally understand Cmake.
@lung@lemmy.world avatar

That’s like one thing ML can actually help with XD cute cat

SatouKazuma , in Uh oh, what have I done

I don’t think I’ve ever produced spaghetti code in my life…

Because my code never works in the first place.

MashedTech OP ,
JokeDeity , in I hate it

Okay, but yes it is if you aren’t being extremely technical and pedantic.

Edgarallenpwn , in no amount of documentation can save users from themselves
@Edgarallenpwn@midwest.social avatar

“I’ll add this to our knowledge base and other people can assist now!”

“Hey So-and-so, it looks like you our are guru at this issue, can you take a look at these 4 users who mentioned the software in their ticket?”

I just need to make progress on my projects, stop giving me desktop tickets pls :)

_stranger_ , in A QA engineer walks into a bar

Doesn’t order shit, waits there while the memory leaks builds to a system crashing crescendo.

cupcakezealot , in no amount of documentation can save users from themselves
@cupcakezealot@lemmy.blahaj.zone avatar

you forgot

end user: this product is defective; the developer should be fired

pineapplelover , in Do you know who can help?

Is there a code example of this?

renormalizer ,

I’ve been a four-star programmer a few times. Imagine a blocked symmetric matrix where the rows and columns are indexed by triples (u,v,w). The entries are zero whenever u != u’ or v != v’, and because of symmetry you only store entries with w <= w’. But the range of v depends on the value of u and the range of w on the value of v. So you do


<span style="font-weight:bold;color:#a71d5d;">double ****</span><span style="color:#323232;">mat </span><span style="font-weight:bold;color:#a71d5d;">= </span><span style="color:#62a35c;">calloc </span><span style="color:#323232;">(UMAX, </span><span style="font-weight:bold;color:#a71d5d;">sizeof</span><span style="color:#323232;">(</span><span style="font-weight:bold;color:#a71d5d;">*</span><span style="color:#323232;">mat));
</span><span style="font-weight:bold;color:#a71d5d;">for </span><span style="color:#323232;">(</span><span style="font-weight:bold;color:#a71d5d;">int</span><span style="color:#323232;"> u </span><span style="font-weight:bold;color:#a71d5d;">= </span><span style="color:#0086b3;">0</span><span style="color:#323232;">; u </span><span style="font-weight:bold;color:#a71d5d;"><</span><span style="color:#323232;"> UMAX; </span><span style="font-weight:bold;color:#a71d5d;">++</span><span style="color:#323232;">u) {
</span><span style="color:#323232;">  mat[u] </span><span style="font-weight:bold;color:#a71d5d;">= </span><span style="color:#62a35c;">calloc </span><span style="color:#323232;">(u </span><span style="font-weight:bold;color:#a71d5d;">+ </span><span style="color:#0086b3;">1</span><span style="color:#323232;">, </span><span style="font-weight:bold;color:#a71d5d;">sizeof</span><span style="color:#323232;">(</span><span style="font-weight:bold;color:#a71d5d;">**</span><span style="color:#323232;">mat));
</span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">for </span><span style="color:#323232;">(</span><span style="font-weight:bold;color:#a71d5d;">int</span><span style="color:#323232;"> v </span><span style="font-weight:bold;color:#a71d5d;">= </span><span style="color:#0086b3;">0</span><span style="color:#323232;">; v </span><span style="font-weight:bold;color:#a71d5d;"><=</span><span style="color:#323232;"> u; </span><span style="font-weight:bold;color:#a71d5d;">++</span><span style="color:#323232;">v) {
</span><span style="color:#323232;">    mat[u][v] </span><span style="font-weight:bold;color:#a71d5d;">= </span><span style="color:#62a35c;">calloc </span><span style="color:#323232;">(v </span><span style="font-weight:bold;color:#a71d5d;">+ </span><span style="color:#0086b3;">1</span><span style="color:#323232;">, </span><span style="font-weight:bold;color:#a71d5d;">sizeof</span><span style="color:#323232;">(</span><span style="font-weight:bold;color:#a71d5d;">***</span><span style="color:#323232;">mat));
</span><span style="color:#323232;">    </span><span style="font-weight:bold;color:#a71d5d;">for </span><span style="color:#323232;">(</span><span style="font-weight:bold;color:#a71d5d;">int</span><span style="color:#323232;"> w </span><span style="font-weight:bold;color:#a71d5d;">= </span><span style="color:#0086b3;">0</span><span style="color:#323232;">; w </span><span style="font-weight:bold;color:#a71d5d;"><=</span><span style="color:#323232;"> v; </span><span style="font-weight:bold;color:#a71d5d;">++</span><span style="color:#323232;">w) {
</span><span style="color:#323232;">      mat[u][v][w] </span><span style="font-weight:bold;color:#a71d5d;">= </span><span style="color:#62a35c;">calloc </span><span style="color:#323232;">(w </span><span style="font-weight:bold;color:#a71d5d;">+ </span><span style="color:#0086b3;">1</span><span style="color:#323232;">, </span><span style="font-weight:bold;color:#a71d5d;">sizeof</span><span style="color:#323232;">(</span><span style="font-weight:bold;color:#a71d5d;">****</span><span style="color:#323232;">mat));
</span><span style="color:#323232;">      </span><span style="font-weight:bold;color:#a71d5d;">for </span><span style="color:#323232;">(</span><span style="font-weight:bold;color:#a71d5d;">int</span><span style="color:#323232;"> ww </span><span style="font-weight:bold;color:#a71d5d;">= </span><span style="color:#0086b3;">0</span><span style="color:#323232;">; ww </span><span style="font-weight:bold;color:#a71d5d;"><=</span><span style="color:#323232;"> w; </span><span style="font-weight:bold;color:#a71d5d;">++</span><span style="color:#323232;">ww)
</span><span style="color:#323232;">        mat[u][v][w][ww] </span><span style="font-weight:bold;color:#a71d5d;">= </span><span style="color:#323232;">some_function (u, v, w, ww);
</span><span style="color:#323232;">    }
</span><span style="color:#323232;">  }
</span><span style="color:#323232;">}
</span>

and weep a little. In reality, this gets a bit optimized by allocating a single chunk of memory and carving that up into the pointer and data arrays, so everything is reasonably close together in memory.

Agent641 ,

uwu, got it.

pineapplelover ,

My brain hurts

pruwybn , in Evolution of C
@pruwybn@discuss.tchncs.de avatar

The last one needs the prongs sticking out to make it a hyperhashtag.

e8d79 , in Principal Skinner on Immutable Distros
@e8d79@discuss.tchncs.de avatar

I am using a immutable Fedora since January and it has been great so far.

quantenzitrone , in Anyone here use assembly?
@quantenzitrone@lemmings.world avatar

If everything above ASM is the Universe, what is below? What is the ALU, CU and everything else that goes into Processor design? What comes before the Universe?

technom ,

Solid state physics.

angelmountain , in Brace Style

How happy I am with prettier. This is just a thing in an ancient past for me now.

Username ,

Recently tried biome for a web project. It’s a combined linter and formatter, and it’s so good. Compatible with prettier too.

key ,

Are you referring to autoformat like most linters and IDEs can do or does prettier have some special transpilation capability to hide braces?

  • All
  • Subscribed
  • Moderated
  • Favorites
  • [email protected]
  • random
  • lifeLocal
  • goranko
  • All magazines