Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Demolishun34622140dLaughs in C++ fuckery !
reinterpret_cast< to any fucking thing >( from any fucking thing );
Probably apples and oranges, but yeah... -
jestdotty5178140d@Demolishun but see it at least makes sense
rust is a straitjacket
so then you should hack the fucking system? fuck's sake design it consistently! -
lorentz15210139dRust has reinterpret_cast, it's called transmute, just the docs appropriately indicate that you should never ever ever use it for any fucking reason. Not because it's a bad implementation but because what these functions do should never be done by anyone for any reason ever.
-
Demolishun34622139d@lorentz so basically only embedded programmers. Which aren't real people anyway.
-
lorentz15210139d@Demolishun Not even embedded programmers should use transmute. If you want to cast between number types, cast through a fixed size array and let your optimizer eliminate the array. If you want to cast a bitfield then you can use the crate of the same name, which probably does it better than you. And it still doesn't need transmute because you can just use a fixed size array.
-
lorentz15210139d@Demolishun Is there a third use case for reinterpret_cast that I don't know about?
-
Demolishun34622139d@lorentz I don't know. I think I have used reinterpret_cast once or twice. It was for working with a C framework to pass pointers to objects that got passed inside the framework. Which used void pointers. reinterpret_cast was more explicit and showed intent better than old style C casts. This aided in hiding all the C dirty secrets inside a C++ wrapper.
-
Lensflare17038139d@Demolishun dayum! I recall doing it as well. That was horrible! Thanks for the flashbacks!
-
lorentz15210139d@Demolishun ah, that's just an as cast, no issue then. reinterpret_cast feels like hunting ducks with a nuke though.
Related Rants
every time I run into some issue in rust and spend days googling and asking a billion AI chat bots turns out it was rust that was wrong
I'm so exhausted
do they have brain worms
nobody considers "hey maybe this feature isn't in yet" (and actually they'll argue against it being a feature and you should feel bad at coming up with it)
they're just like "you're doing it wrong!"
YOU HAVE ALL THE INFORMATION TO INFER THE TYPE AND YOU DID INFER THE TYPE YET YOU TELL ME I NEED TO ANNOTATE THE TYPE BUT YOU'VE INFERRED IT AND YOU CANT TELL ME WHY I NEED TO ANNOTATE IT
And I love how suddenly you can convert a Result object using `as` which is a keyword reserved only for primitives, so say the docs... and it works (and works at runtime as well). because the type was never wrong. you fucking inferred it. but you're bitching at me that you need an annotation. when you don't.
remember when languages were made by people that actually liked coding instead of this clout-chasing nonsense. that's what I'm blaming this on
rant
rust