Having an asterisk both be the type indicator and the dereference operator is one of the great programming language design blunders of our time, along with allowing nulls for any type in so many languages.
Whitespace
Submitted 1 year ago by JPDev@programming.dev to programmer_humor@programming.dev
https://programming.dev/pictrs/image/6c0ae859-45c1-48ec-8e9d-2b5b4a552220.webp
Comments
GissaMittJobb@lemmy.ml 1 year ago
darkpanda@lemmy.ca 1 year ago
I also sometimes wish that the syntax in
if
statements was inverted, where()
was optional and{}
was required.CodexArcanum@lemmy.world 1 year ago
Rust makes this choice and it is way better.
victorz@lemmy.world 1 year ago
Based
clay_pidgin@sh.itjust.works 1 year ago
Cab you give me an example? I’m not sure I follow. Might be language specific?
Blackmist@feddit.uk 1 year ago
Having assignments return a value is right up there as well.
GissaMittJobb@lemmy.ml 1 year ago
Because of the possibility of accidentally performing an assignment in a conditional expression?
If yes, I agree that it’s not great.
dbilitated@aussie.zone 1 year ago
I’m just a c# dev wishing to fuck we had something visual to indicate reference types so my coworkers could stop misusing them
jjagaimo@lemmy.ca 1 year ago
stackoverflow.com/…/how-can-i-give-different-colo… might get you closer?
dbilitated@aussie.zone 1 year ago
oh thank you! I use jetbrains but I wonder if I can implement the same thing
vithigar@lemmy.ca 1 year ago
It’s such a short list of value types though. How can they have that much trouble? All of the various ints and floats, bool, char, structs, and enums. Everything else is reference.
fl42v@lemmy.ml 1 year ago
std::shared_ptr<int> p;
victorz@lemmy.world 1 year ago
Wait until I tell y’all about const.
exocrinous@lemm.ee 1 year ago
Int *p is unreadable, unreasonable, and bad programming.
Ferk@kbin.social 1 year ago
But the syntax clearly intends
int *p
.
Otherwise you would only need to doint* p, q
instead actually being required to type*
in front of every variable name when declaring that way:int * p, * t;
exocrinous@lemm.ee 1 year ago
That’s because C was designed by a fool.
Aatube@kbin.social 1 year ago
Why so? It’s what it actually is
catconnoisseur@lemmy.ml 1 year ago
no int * ptr fans here?
RandomCookie420@eviltoast.org 1 year ago
Ever written a entire php in one line? I did, and that without separation whenever possible.
Man my coworker even ended the trolling contest over that.
db2@lemmy.world 1 year ago
int * p;
kambusha@feddit.ch 1 year ago
Here is an otter
Image
otter@lemmy.ca 1 year ago
:)
Deceptichum@kbin.social 1 year ago
Male otters kidnap children otters and hold them for ransom until the mum gives them food.
thomasloven@lemmy.world 1 year ago
I’ve seen that in style guides ”because it should piss of everyone equally”.