329
top 43 comments
sorted by: hot top controversial new old
[-] deadbeef79000@lemmy.nz 1 points 5 hours ago
[-] Flipper@feddit.org 78 points 4 days ago

I'm not sure if this is serious or not and that scares me.

[-] Swedneck@discuss.tchncs.de 89 points 4 days ago

the :================D operator

[-] sunoc@sh.itjust.works 22 points 4 days ago
[-] ZILtoid1991@lemmy.world 6 points 3 days ago

New language idea:

:====D
:==========D 0
:=======0==D~~~
:==========D ~0
[-] Blackmist@feddit.uk 18 points 3 days ago

I honestly don't know why they even have -> instead of just a dot like everyone else. The compiler knows whether it's a record, object, pointer, or any level of pointer to pointers.

Why make the programmer do the donkey work?

[-] Morphit@feddit.uk 11 points 3 days ago

It's important for objects that can be dereferenced. Smart pointers have methods that can be accessed with dot syntax like swap(). You can still dereference through a smart pointer using arrow syntax to access methods on the referenced type since they overload the operator->() method.

[-] skulbuny@sh.itjust.works 2 points 3 days ago

I love the arrow in functional programming. Some functional languages (like reasonml) has multiple arrow operators that did different things like this one -> would put the argument in the first position (a popular JS pattern) and the big arrow |> would put it last like most functional languages.

I know this is about CPP but honestly I love the way it looks, but I'm a weirdo lol

[-] Hirom@beehaw.org 43 points 4 days ago* (last edited 4 days ago)

Rest of the world: We're deprecating C++ due to lack of memory safety. Please consider doing something for safety.

C++ commite: Here's a new convenient operator to make it easier to do a potentially unsafe, multi-level pointer dereference.

[-] witx 13 points 3 days ago

Please don't give them ideas

[-] MinekPo1@lemmygrad.ml 24 points 4 days ago

note that the -- -> operator is different than --->

[-] merthyr1831@lemmy.ml 14 points 4 days ago

I pray for this to be real because it's the perfect syntactic sugar for C++. The kind that you'd think makes sense if you didn't have to write C++ for anything more complex than a high school project.

[-] mindbleach@sh.itjust.works 4 points 3 days ago

Right? Every C++ feature needs to be lightly cursed.

[-] mariusafa 16 points 4 days ago
[-] WhyJiffie@sh.itjust.works 3 points 3 days ago
[-] mariusafa 1 points 3 days ago

I really hope so but they first need a language specification. Without that it's no use for me.

[-] within_epsilon@beehaw.org 4 points 3 days ago

New feature with terrible syntax. There are features of every language I choose not to use. As a C++ developer, I would choose not to use this syntax, so that my team can write better designed code. However, I am an oddball on my team for loving trailing return types. In peer review, the schlong operator i.e. ---> would only be used where it makes sense which should be nowhere.

Peer reviewing this seriously would require knowing more context. Instinct tells me MyClass**** is probably allocated from the heap. A possible reason for so many levels of indirection are jagged arrays. Maybe the function only gets the first element of each level of the arrays. The function name doesn't make that clear. This is poorly designed. Please re-design/re-write. I will happily review those changes. I expect unit tests to show example use cases.

I would suggest using a stack allocated array with sentinels for missing values to improve cache coherency. Without context, I assume looping over the jagged structure will be common. Loading more into cache should improve efficiency in loops, but benchmarks are required.

Wait... I should join the crowd. So I say, "down with C++" and up with some safe alternative. Maybe rust: https://github.com/Speykious/cve-rs.

[-] socsa@piefed.social 1 points 3 days ago

Best i can imagine, this is what happens if you are terrified of smart pointers, but also want to make all object pointers scope specific. So at every layer of hierarchy, you have a unique reference to some partial implementation above and below it.

Honestly I struggle to imagine any real scenario where this would make sense... except maybe like some kind of insane recursive factory.

C++ is a joke.

[-] HauntingScience@programming.dev 11 points 4 days ago
this post was submitted on 29 Dec 2024
329 points (98.8% liked)

Programmer Humor

19817 readers
209 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS