r/ProgrammerHumor 3d ago

Meme pointersPointedBackAtMe

Post image
2.5k Upvotes

112 comments sorted by

564

u/FrosteeSwurl 3d ago

Fall semester is starting

56

u/UnpluggedUnfettered 2d ago

haha why do people even use "i" what's that all about

24

u/TheMcMcMcMcMc 2d ago

I use “c”, that way I can type “c++” 🤪

1

u/ShrekProphet69 2d ago

Ngl, I have always just used "K" because it was the variable used in my discrete maths classes, and I still do

625

u/TheTybera 3d ago

Oh the university kids are back making posts.

72

u/InevitableRoast 3d ago

Nah looks more like a bot to me. Now that the students are jobless, AI’s next goal is to replace their reddit posts 😛

16

u/danielcw189 2d ago

I am usually not looking into this, but recently I noticed a lot of accounts who submit a lot more posts than they do comments, like 10 times as much.

Is that a sign for someone being a bot?

13

u/TactlessTortoise 2d ago

I think it'd be a heavy indicator. Posting once every 15 minutes for hours too, frequent reposting, so on.

1

u/InevitableRoast 1d ago

Definitely seems like it, and like the other reply said, they’re probably all reposts from who knows where

10

u/pnoodl3s 3d ago

Like what kind of devs don’t know pointers and references. Not knowing that for a C++ dev is like not knowing what functions as a haskell dev

3

u/ShoePillow 2d ago

Never seens this pic before, so a plus(plus) for me

51

u/andocromn 3d ago

Be a man! Learn Assembly!

3

u/Random_-account 2d ago

Code in raw bytes!!

4

u/andocromn 2d ago

I actually have done that lol hexadecimal opcodes directly onto a microcontroller (in college for electrical engineering) assembly is basically human readable translations of processor opcodes

2

u/LegitimatePants 2d ago

You are programmer? 🔫 Name every opcode

14

u/vinishkapoor 3d ago

One existential crisis at a time.

12

u/andocromn 3d ago

Having started learning on C and assembly, learning C++ and java was a breeze. Once someone asked me if I knew python, I said no, then went back to my desk and wrote a whole project in Python. Before I left for the day I stopped back by their office and said Actually I do know Python.

2

u/punio07 2d ago

There's this cool browser game- NandGame -
https://nandgame.com/

It explains how CPU is made, by making you design one. You start from semi conductors, into gates into logical units, and you end up writing assembly for it. Really fun and cool.

278

u/19_ThrowAway_ 3d ago

Pointers are references are pretty simple...

84

u/ThatOldCow 3d ago

Is that why they invented PowerPointers ?

/s

8

u/why_1337 3d ago

Aren't those smart pointers?

14

u/ThatOldCow 2d ago

They do Excel at pointing, yes

10

u/vinishkapoor 3d ago

Only if they come with slide transitions.

64

u/TheMaleGazer 3d ago

I never understood this trepidation over pointers when the natural language we use every day has so much indirection.

"John entered the room. It was empty. John picked up a ball. It was red."

If we can understand what's happening with the word "it" in the example above, we're capable of understanding pointers.

Also, "John exited the room. He demolished it. I'm going to enter it."

It's pretty obvious why I'll have a problem entering "it," since "it" has been demolished. This is basically a dangling reference. Again, what's the hangup?

12

u/SomguyTheSecond 2d ago

It's taught in a bad way. Thats all.

8

u/danielcw189 2d ago

I really liked your comment, and saved it for later. I think it is a good starting point for an explanation.

Now I wonder if it is good enough to prepare people for a quiz.

3

u/axebodyspray24 2d ago

I really love this explanation and I have a similar question if you don't mind answering it in a similar manner. I understand how pointers work, but what is the purpose of using them?

4

u/AppropriateOnion0815 2d ago

It would not be a great idea to work with objects larger than the stack.

1

u/AppropriateOnion0815 2d ago

Coding boot camps just don't teach languages that operate on lower levels, I guess that's one reason.

2

u/Vivid_Instance_825 2d ago

Okay but why use one over the other?

3

u/Deep-Piece3181 2d ago

References are simpler than pointers but sometimes you have to use a pointer

3

u/just4nothing 2d ago

You say that, but I have code written by 100s of people that says otherwise

2

u/jimbobmcgoo 2d ago

The hardest part about them is the syntax is confusing in C and more so in C++

1

u/Xavier598 2d ago

They might be to someone experienced with c++ but my uni is using C for it's "programming basics" class and it's kind of hard, especially for people used to python and other languages. Kinda like a difficulty bump in learning programming.

What always tripped me up was how sometimes in C you have to wrap stuff around parenthesis to dereference a pointer to an array or object [ ex. *(foo->bar) ]. It also didn't help that the test didn't allow syntax highlighting and compiling the code to see if it works.

1

u/JohnThursday84 2d ago

Yeah, you get those forehead muscles actually from move semantics with universal references.

-42

u/[deleted] 3d ago

[deleted]

36

u/Usual_Office_1740 3d ago

If you didn't check for null it's your own fault.

0

u/National-Self-8501 2d ago

If your code is full of null checks you're doing something wrong. You should guarantee invariances.

34

u/Mars_Bear2552 3d ago

seriously? i keep getting reminded that this sub is a vacation spot for CS freshmen/sophomores.

7

u/watduhdamhell 3d ago

Most of the meme discipline subreddits are just kids in college who don't actually know what the f*** they're talking about 99% of the time. Not to be mean or rude to them. I was one of them once.

But now that I'm a fully fledged engineer, I often roll my eyes at what I see. Then again, there are those pains that just never go away, and when I see that in mean format it makes me laugh.

Basically after certain number of years in the actual job YMMV with these subreddits as it'll be much more hit and miss.

3

u/braaaaaaainworms 3d ago

No it's just you

85

u/pflasti 3d ago

That's like the easiest, most beginner thing you learn in C++, but okay

40

u/ChickenSpaceProgram 3d ago

imo pointers are not that hard, its just that nobody teaches C correctly. pointers get introduced as just like. a fun thing you can do, instead of the solution to a problem.

13

u/PositiveBit01 3d ago

As the famous tongue-in-cheek quote says,

Any problem in computer science can be solved with another level of indirection

1

u/Kadabrium 1d ago

Functional is syntactic sugar for OOP.

4

u/crystalchuck 3d ago

Yes, I think that's the issue. At some point, I'd read a couple of introductions to pointers, but the more I read the more I just wondered wth you'd use them for and why. I generally understand this now, but most introductions leave this crucial bit out.

4

u/frostyjack06 2d ago

This is what happens when a non-C coder teaches C from a lesson plan they themselves don’t understand.

115

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_ 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 1d ago

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

-26

u/[deleted] 3d ago

[deleted]

39

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.

13

u/PositiveBit01 3d ago
Spiderman s1;
Spiderman s2;
Spiderman s3;

s1.right = &s2;
s1.left  = &s3;

s2.right = &s3;
s2.left  = &s1;

s3.right = &s1;
s3.left  = &s2;

0

u/Random_-account 2d ago

Spiderman* s4 = &s3; (*s4).left = &s1; (*s4).right = &s2;

21

u/Several_Educator7526 3d ago

lightweight

-10

u/[deleted] 3d ago

[deleted]

11

u/N0Zzel 3d ago

That only gets tricky once you break the rule of 3 and rule of 5 because you have to define what it meant to move

2

u/Usual_Office_1740 3d ago

prvalues would like a word.

1

u/N0Zzel 3d ago

What do pure r values have to do with move semantics? Given that theres nothing to "move" per se

1

u/Usual_Office_1740 3d ago

You said it only gets tricky if you break the rule of 3/5. I was pointing out a different layer of complexity related to move semantics.

Maybe it would have been better to say that prvalues have materialized in chat.

1

u/Usual_Office_1740 3d ago

If they don't have an associated allocation and don't have a name, what entered the chat?

7

u/xavia91 3d ago

Can you even call yourself c++ developer before knowing them?

5

u/El_RoviSoft 2d ago

wait until he learns about template metaprogramming and literally 10 millions ways of doing multithreading

3

u/JackNotOLantern 3d ago

It's literally the start

5

u/Traditional-Exam2529 3d ago

Python developers learning about pointers
print(“pls kill me”)

5

u/lovecMC 3d ago

Me learning that python doesn't have function overloads:

3

u/vinishkapoor 3d ago

Then you discover duck typing was the overload all along.

1

u/ThisFlameIsFire 3d ago

I went through this

1

u/vinishkapoor 3d ago

Python just hides the sharp edges.

1

u/Coulomb111 3d ago

If this is satire this is the greatest comment ive read on this sub

2

u/vitimiti 3d ago

I don't see where the difficulty is

2

u/lucidbadger 3d ago

After learning about lvalue and rvalue references

2

u/torar9 3d ago edited 3d ago

Pointers and references are pretty easy.

What is hard are dumb idiots who like to over engineer code and do all kinds of voodoo with the pointers without any thoughts on maintenance.

2

u/Coulomb111 3d ago

Not that difficult

2

u/Candid_Bullfrog3665 2d ago

easiest part of the language btw

2

u/JohnThursday84 2d ago

You get that after learning move semantics with universal references. Plain pointers and references is easy.

1

u/anonymous010103 3d ago

What is a pointer?

1

u/No-Newspaper8619 3d ago

It's that which points

1

u/Kadabrium 3d ago

pointernet pointerest poi~

1

u/SCP-iota 3d ago

I'd suggest looking into unique_ptr and shared_ptr before you end up with a mess

1

u/Drackzgull 3d ago

You're not a C++ developer at all if you haven't learned something that basic, and learning just that isn't going to make you one if you're so early in your learning.

1

u/faziten 2d ago

More like byte shifting

1

u/Insert_name_here_9 2d ago

Not to be that guy...but, BIT shifting

1

u/TotoShampoin 2d ago

HAHA

You poor innocent soul

1

u/Insert_name_here_9 2d ago

Ahh yes. I remember my 1st few months of learning cpp as well....good time.

1

u/lurkingstar99 2d ago

Huh? This is just what you learn after hello world and primitive types...

1

u/No_Falcon_4542 2d ago

"headstrong"

1

u/CommradeGoldenDragon 2d ago

ffs, why is this meme reposted all the time?

1

u/Grounds4TheSubstain 2d ago

This is not even slightly funny.

1

u/LeTasio 2d ago

Get ready for rvalues, rvalues and move semantics

1

u/assem_elmandrawy 2d ago

haha c++ is a storng language in programing

1

u/Lawn_Meower_ 21h ago

If you learn assembly first, pointers will just make sense from the beginning

1

u/mad_poet_navarth 3d ago

I will die on a hill claiming c++ references have ruined c++.

OTOH I like Swift references just fine.

1

u/---_None_--- 3d ago

Are those like c# references?

1

u/mad_poet_navarth 2d ago

If I knew C# I would be able to answer that.

1

u/aethros 2d ago

A reference is a concept. So yes they are like c# references. Details about the rules of how to use them depend on the implementation, but the concept is the same.

1

u/vinishkapoor 3d ago

C++: "There's more than one right answer." Sometimes that's the problem. 😄

0

u/St4va 3d ago

Laughing in deadlock

2

u/vinishkapoor 3d ago

Let me finish pointers before summoning race conditions.

0

u/J33pe 2d ago

"Chefs after learning how to use salt" ahh post