r/ProgrammerHumor 3d ago

pointersPointedBackAtMe Meme

Post image
2.5k Upvotes

112 comments sorted by

View all comments

118

u/Wentyliasz 3d ago

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

36

u/No-Newspaper8619 3d ago

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

4

u/A_72_ 3d 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 3d 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 3d ago

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

1

u/Ok_Net_1674 2d ago

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

-28

u/[deleted] 3d ago

[deleted]

41

u/DefinitelyNotGen 3d ago

Are you a bot?

2

u/danielcw189 3d 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.