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.

lemmy.ml

Turious , to memes in Beercycling

Tasty nitrogen.

thechadwick , to ukcasual in Tell me this isn't David Mitchell

It’s called: “THAT MITCHELL AND WEBB LOOK”! Why else do you think they named it that way?

user1234 , to ukcasual in Tell me this isn't David Mitchell

This isn’t David Mitchell

DosDude , to memes in Beercycling
@DosDude@retrolemmy.com avatar
zea_64 , to programmer_humor in You can certainly change it. But should you?

It makes more sense if you think of const as “read-only”. Volatile just means the compiler can’t make the assumption that the compiler is the only thing that can modify the variable. A const volatile variable can return different results when read different times.

fl42v OP ,

I thought of it more in terms of changing constants (by casting the const away). AFAIK when it’s not volatile, the compiler can place it into read-only data segment or make it a part of some other data, etc. So, technically, changing a const volatile would be less of a UB compared to changing a regular const (?)

Scoopta ,
@Scoopta@programming.dev avatar

const volatile is used a lot when doing HW programming. Const will prevent your code from editing it and volatile prevents the compiler from making assumptions. For example reading from a read only MMIO region. Hardware might change the value hence volatile but you can’t because it’s read only so marking it as const allows the compiler to catch it instead of allowing you to try and fail.

humbletightband ,

I will not tell my kids regular scary stories. I will tell them about embedded systems

suzune ,

When you program embedded you’ll also dereference NULL pointers at some point.

More...Some platforms can have something interesting at memory address 0x0 (it’s often NULL in C).

humbletightband ,

I was thinking about telling them how in embedded systems it’s a good practice to allocate the memory by hand, having in mind the backlog, but yours will come first

Scoopta ,
@Scoopta@programming.dev avatar

In amd64/x86 kernel space you can dereference null as well. My hobby kernel keeps critical kernel structures there XD.

mox , (edited )

AFAIK when it’s not volatile, the compiler can place it into read-only data segment

True, but preventing that is merely a side effect of the volatile qualifier when applied to any random variable. The reason for volatile’s existence is that some memory is changed by the underlying hardware, or by an external process, or by the act of accessing it.

The qualifier was a necessary addition to C in order to support such cases, which you might not encounter if you mainly deal with application code, but you’ll see quite a bit in domains like hardware drivers and embedded systems.

A const volatile variable is simply one of these that doesn’t accept explicit writes. A sensor output, for example.

TheEntity ,

The very notion of “less of a UB” is against the concept of UB. If you have an UB in your program, all guarantees are out of the window.

fl42v OP ,

I mean, changing a const is itself a questionable move (the question being whether the one doing it is insane)

QuaternionsRock ,

I’ve never really thought about this before, but const volatile value types don’t really make sense, do they? const volatile pointers make sense, since const pointers can point to non-const values, but const values are typically placed in read-only memory, in which case the volatile is kind of meaningless, no?

zea_64 ,

Maybe there’s a signal handler or some other outside force that knows where that variable lives on the stack (maybe through DWARF) and can pause your program to modify it asynchronously. Very niche. More practical is purely to inhibit certain compiler optimizations.

rooster_butt ,

They do in embedded when you are polling a read only register. The cpu can change the register but writing to it does nothing.

QuaternionsRock ,

That seems like a better fit for an intrinsic, doesn’t it? If it truly is a register, then referencing it through a (presumably global) variable doesn’t semantically align with its location, and if it’s a special memory location, then it should obviously be referenced through a pointer.

nothacking , to programmer_humor in You can certainly change it. But should you?

This is actually how you should declare something that you will never change, but something might change externally, like an input pin or status register.

Writing to it might do something completely different or just crash, but you also don’t want the compiler getting creative with reads; You don’t want the compiler optimizing out a check for a button press because the “constant” value is never changed.

sunbeam60 ,

Yeah I stumbled on this too. Surely the joke should be const mutable, not const volatile.

sirico , to ukcasual in Tell me this isn't David Mitchell
@sirico@feddit.uk avatar
SubArcticTundra OP ,
@SubArcticTundra@lemmy.ml avatar

I have never felt like more of an expert on caring.

thegiddystitcher , to ukcasual in Tell me this isn't David Mitchell
@thegiddystitcher@lemm.ee avatar

But he looks nothing like Dav…o wait.

Hossenfeffer , to ukcasual in Tell me this isn't David Mitchell
@Hossenfeffer@feddit.uk avatar

Which one?

ReiRose , to foodporn in First time trying my luck with a Dutch Baby

Your Yorkshire pudding looks like it needs more gravy.

NovaPrime OP ,
@NovaPrime@lemmy.ml avatar

Wouldn’t have minded a little drizzle of gravy on top tbh 😜

PriorityMotif , to programmer_humor in You can certainly change it. But should you?
@PriorityMotif@lemmy.world avatar

Looks like they didn’t want anybody using the secondary tank. Probably haven’t had time to pull Dave’s body out yet.

Qwaffle_waffle , to programmer_humor in You can certainly change it. But should you?

This has 14 (Peter Cline) energy here for the photo. Keep the dials at zero!

Restaldt , to programmer_humor in You can certainly change it. But should you?

const…ish

Synthuir ,

constn’t

Slotos ,

I’m giggling like a kid that finally got the candy from the top drawer. It’s beautiful.

darkmogool , to programmer_humor in You can certainly change it. But should you?

Is this wrench made of chocolate?

CptEnder ,

Forbidden chocolate

XEAL , to programmer_humor in You can certainly change it. But should you?

What is the context of the original image?

isVeryLoud ,

Could be simply a way to make sure the button never moves again. I would have simply taken out the knob, personally.

octobob ,

I work on industrial controls. Very likely that the switch is momentary, meaning it’ll go back when released.

Sometimes there’s a little piece of plastic in them to remove the momentary setting, but this works too lol. Fuck it, it’s maintenance.

isVeryLoud ,

That actually makes sense, thank you for the tidbit!

Still kind of an overkill solution haha

hstde ,

It could be about sending a message.

A missing knob is easy to fix. Bolting a wrench to the housing holding the knob in place is very explicit. It screams “don’t touch”

isVeryLoud ,

Idk to me it screams “solve this puzzle and win a free wrench” /s

I like the creativity of it, and it does solve the problem in a way that’s user-safe. I thought of removing the knob because that’s what I do with my barbecue as I store items on the grill when not in use. Remove knobs, put on grill, close barbecue, cover.

Omega_Haxors ,

Idk to me it screams “solve this puzzle and win a free wrench” /s

What too many video games does to a mfer 😄

Fubarberry ,
@Fubarberry@sopuli.xyz avatar

I’m sure they just needed a way to lock the selector knob to the primary position, and didn’t want to rewire it.

octobob ,

Drills and taps two holes, adds a metal strap, and sacrifices a tool to save a 5 minute fix of jumping over the contact with a 2" piece of wire lmfao

Fubarberry , (edited )
@Fubarberry@sopuli.xyz avatar

A lot of people won’t touch electrical, and the problem with modifying the wiring is you need to be able to clearly document or show what was changed in case it needs to be reversed later.

This is ugly, but it’s immediately obvious how to reverse it to anyone who looks at it. And that pipe wrench probably wasn’t being used anymore anyways. I doubt they tapped the holes, those are probably just self-tap screws that both drilled the hole and cut the thread as they screwed in. No one will call this an elegant solution, but if it works it works.

octobob ,

“documenting the change” is a pipe dream.

If you’ve ever worked in maintenance, active production, etc, you’ll be lucky to even have schematics. And trust me, there are a lot of hacks of people fucking with controls for 30+ years straight that soooo much of it is full of “fixes” like this, whether it’s something pushing a button in, or pieces of metal instead of fuses, or wires jumping over what’s “in the way” like whole safety systems and e-stops, contactors forced to run, etc etc etc.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • lifeLocal
  • goranko
  • All magazines