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.

0x0 , in "No way to prevent this" say users of only language where this regularly happens - 07/01/2024

The “C is bad trope” is getting way too old. I’m surprised the author didn’t plug Rust.

the only programming language in the world where these vulnerabilities regularly happen

Maybe because it’s one of the most widely used languages in the world…

sukhmel ,

Well, one of the most widely used that allows to do low-level stuff. The most widely used one is by far JavaScript but good luck making an OS or a device driver with it

fuzzzerd ,

I’m sure there are projects covering those areas written in JavaScript.

echindod ,

Oh gawd. That would be so horrible! Is there a project o compile JavaScript to bytecode? With like LLVM? There must be, but I haven’t heard of it. I shouldn’t even say anything because I will be better off pretending it doesn’t exist.

calcopiritus ,

Just bundle a JavaScript interpreter with the JavaScript code. No need to compile JavaScript.

OutsideNo1877 ,

Just because you can doesn’t mean you should and i hope that is not a thing

BatmanAoD ,

The trope will be “old” once the mainstream view is no longer that C-style memory management is “good enough”.

That said, this particular vulnerability was primarily due to how signals work, which I understand to be kind of unavoidably terrible in any language.

5C5C5C ,

A better language wouldn’t have any need to use POSIX signals in this way.

BatmanAoD ,

I’m not totally clear on why signals are used here in the first place. Arguably most C code doesn’t “need” to use signals in complex ways, either.

KillingTimeItself , in How programmers comment their code

this is why i very varely comment with descriptive comments. If you’re reading my code and don’t understand what it is, even with how shit it is, you have no business reading whatever fucking crackpot shit im writing.

potustheplant ,

You must be fun to work with.

KillingTimeItself ,

you say this like im the type of person to write code with other people.

potustheplant ,

Doesn’t matter. Even if it’s your code, you might revisit something you made months or a year after doing it and having comments will speed up your work. It’s a very basic good practice.

KillingTimeItself ,

i do have comments, for some things, but there are a lot of “commenting” standards that are just shit. I find i don’t care what the actual piece of code is doing, i care more about it’s place in the rest of the code, and i’d much rather have “anti comments” instead.

bloubz , in Average CSS

I guess the class matches the color of the background (applied on a parent element), and the text is the opposite color?

Ephera ,

My guess would be that they initially named the classes like the colors and then decided to swap those two colors.

bloubz ,

Pretty good guess

communism ,
@communism@lemmy.ml avatar

Lime text with a white background or vice versa sounds horrifying and illegible

bleistift2 , in Average CSS

The author should be killed for indentation alone.

mosiacmango ,

I know, right? Needs more tab.

afox ,

We are witnessing a hate crime.

9point6 , in Average CSS

Not allowed to credit the site in your text editor?

Is the owner in the room with you now?

GregorTacTac OP ,
@GregorTacTac@lemm.ee avatar

This screenshot is not mine, it was sent to me via Matrix

Natanael ,

You get used to it. I don’t even see the code

GregorTacTac OP ,
@GregorTacTac@lemm.ee avatar

Do you have a built-in browser in your brain that renders it?

dohpaz42 ,
@dohpaz42@lemmy.world avatar

All I see is blonde, brunette, redhead. Hey uh, you want a drink?

GregorTacTac OP ,
@GregorTacTac@lemm.ee avatar

Free drink? Absolutely

dohpaz42 ,
@dohpaz42@lemmy.world avatar

It’s good for two things: De-greasing engines and killing brain cells.

GregorTacTac OP ,
@GregorTacTac@lemm.ee avatar
GregorTacTac OP ,
@GregorTacTac@lemm.ee avatar

It’s only now that I realise that I understood that reference so late

roguetrick ,

Took ya a bit Keanu, but you got there.

nifty ,
@nifty@lemmy.world avatar

…it was sent to me via Matrix

That’s how they do pull requests there

ClassifiedPancake , in How programmers comment their code

At work we let Typescript and descriptive naming document our code. Only when something is a workaround or otherwise weird will we add comments. So far it has worked great for us.

marcos , in Average CSS

Well, that’s what you get for using classes like “white” and “lime”.

dajoho ,

Exactly this. Bootstrap killed the css star.

ClassifiedPancake , in Site: "I don't feel so good...."

Rotate <body> veeeeeeery slowly

bricklove , in How programmers comment their code

I got a media failed to load error at first and thought that was the joke

ArchRecord ,

Both jokes can be true 😅

yetAnotherUser , in How programmers comment their code

<span style="color:#323232;">/*
</span><span style="color:#323232;"> * Gets stupidFuckingInteger
</span><span style="color:#323232;"> *
</span><span style="color:#323232;"> * @returns stupidFuckingInteger
</span><span style="color:#323232;">*/
</span><span style="color:#323232;">public double getStupidFuckingInteger() {
</span><span style="color:#323232;">    return stupidFuckingInteger;
</span><span style="color:#323232;">}
</span><span style="color:#323232;">
</span>
mrpants ,

The lack of a return type declaration makes this sooo good.

expr ,

It has the return type declared to be double.

mrpants ,

I cannot read. Even better.

ILikeBoobies ,

Makes sense, people looking for int would find a double

Amir ,
@Amir@lemmy.ml avatar

This being a double physically hurts

AdNecrias ,

Reminds me of a job I had where c# summaries were mandatory and people used a documentation generator just like that.

/// Ages the Category. public int AgeCategory (…)

schnurrito ,

plenty of APIs in Java have documentation like that and it is worst when I read the documentation in order to find out the definition of the nouns and verbs used there and then it is just like that

snaggen , in How programmers comment their code
@snaggen@programming.dev avatar

Comment about image

Fargeol ,

answer: the answer

const ,
@const@sh.itjust.works avatar

Reply about comment about image

fnmain , in How programmers comment their code
bjoern_tantau , in Average CSS
@bjoern_tantau@swg-empire.de avatar

People learning CSS through shitty frameworks:

mundane , in How programmers comment their code

Comments should explain “why”, the code already explains “what”.

smeg ,

The allowable exception is when the what is a what the fuck, as in you had to use a hack so horrible that it requires an apology comment

mundane ,

Absolutely, although I see that as part of why

Why is there a horrible hack here? Because stupid reason…

bleistift2 ,

Describing the what also helps when you dabble in a new technology or little-used technology. It helps to explain to yourself what you’re doing and it helps in onboarding. “Hey, newbie, there’s a function in XYZ module that’s extensively documented. Look there for guidance.”

sukhmel ,

Or if the what is so cryptic and esoteric that it would require the reader a couple hours of research to understand it.

Also, I find it useful to summarise the what before code blocks if that can’t be summarised in a function name

azdle ,
@azdle@news.idlestate.org avatar

Unless you’re working with people who are too smart, then sometimes the code only explains the how. Why did the log processor have thousands of lines about Hilbert Curves? I never could figure it out even after talking with the person that wrote it.

ripcord ,
@ripcord@lemmy.world avatar

“Smart”

mundane ,

If you know how the code does something, you also know what it does.

calcopiritus ,

Inline comments yes.

Function/Class/Module doc comments should absolutely explain “what”.

mundane ,

You are absolutely right. It was inline comments I had in mind.

MystikIncarnate ,

I don’t code, at best I script. I’m a sysadmin, not a dev, so I play around in PowerShell mostly.

I just started to naturally do all of this. Not because I was taught to, but because I’ve written too many scripts that I later looked at, and thought, WTF is going on here… Who tf wrote this? (Of course it was me)…

So instead of confusing my future self, I started putting in comments. One at the beginning to describe what the file name can’t, and inline comments to step me through what’s happening, and more importantly why I did what I did.

The sheer number of comments can sometimes double the number of lines in my script, but later when I’m staring into the abyss of what I wrote, I appreciate me.

myplacedk ,

I agree.

I usually think of that as documentation, not comments.

But even so, the code should say what it does, with a good name. The documentation adds details.

independantiste , in Average CSS
@independantiste@sh.itjust.works avatar

At first I only noticed the indent. Wtf

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