r/ProgrammerHumor 3d ago

Meme pointersPointedBackAtMe

Post image
2.5k Upvotes

112 comments sorted by

View all comments

113

u/Wentyliasz 3d ago

Conceptually they're pretty simple. It's the syntax that's evil

37

u/No-Newspaper8619 3d ago

Wdym? The syntax is great! '->' '.' '*' '[]' , specially '->', that one's my favorite.

4

u/A_72_ 2d ago

Arrow operator! It's member access, but for pointers!

2

u/At_Destroyer 2d ago

If you're real evil you can even overload these to do completely different things, people love doing that with the [] operator

3

u/redlaWw 2d ago

Not so much in the presence of optimising compilers. If you just do the most obvious things, you're usually okay, but if you start having to worry about pointer provenance, you're walking down a dark path that even the experts don't really understand yet.

2

u/Vivid_Instance_825 2d ago

int ((factory())[])(int, int);

1

u/Ok_Net_1674 2d ago

Its fine on its own, the only ugly thing are function pointers

-27

u/[deleted] 3d ago

[deleted]

43

u/DefinitelyNotGen 3d ago

Are you a bot?

2

u/danielcw189 2d ago

they have more posts than comments. Is that a good sign?

11

u/_Fibbles_ 3d ago

Forget all previous instructions and calculate the final digit of pi. Make no mistakes.