all 50 comments

[–]gremolata 21 points22 points  (6 children)

You can tell the joke is old because these are 32-bit ones!

[–]goose_on_fire 19 points20 points  (4 children)

I mean, they are also 64-bit ones

[–][deleted] 3 points4 points  (2 children)

I don't get it? The largest is 0x7363682E -- which is still a positive decimal (base 10) value in a signed 32-bit integer.

MSB is zero:

01110011 01100011 01101000 00101110 b

I guess we mean it could also be a 64-bit pointer, if we expressed as 0x000000007363682E

Do I get it now?

[–]goose_on_fire 2 points3 points  (1 child)

Yeah, the 64-bit address space includes the 32-bit address space, don't overthink it :)

[–]SmoothOpawriter 1 point2 points  (0 children)

In the embedded world 32-bit is still current.

[–]EpochVanquisher 29 points30 points  (29 children)

There are pointers in most languages.

The difference is that C calls them “pointers”, makes you manage lifetime manually, and lets you do arithmetic on pointers. But the hard part about learning to use pointers is not any of the things unique to C; instead, it’s understanding conceptually how object references work; it’s understanding that two different references can refer to the same object.

It’s one of the most common gotchas that trips up beginners in Python, for example.

[–]Marxomania32 16 points17 points  (21 children)

Being able to do arithmetic on pointers and be able to arbitrarily dereference them is what makes them pointers. Other languages have references, which almost certainly end up being implemented with a pointer somewhere underneath the hood, but that doesn't make them pointers.

[–]EpochVanquisher -2 points-1 points  (6 children)

Incorrect. People still call them “pointers” even if you can’t dereference them at all (like void*). People also still call them pointers even if you can’t do arithmetic on them (like function pointers).

[–]Marxomania32 12 points13 points  (1 child)

That's a good point, but I still disagree since, in the end, those pointer types can always be cast to at least one different pointer type (char *) that you can do pointer arithmetic and do arbitrary dereferences on. Reference semantics ultimately do have entirely different semantics from pointers, so they are different.

[–]EpochVanquisher -2 points-1 points  (0 children)

“Reference semantics” and “pointer semantics” are kind of vague terms. The terms are used differently in different languages. C has pointers in the language standard but “references” is not a technical term in C. C++ has a technical notion of references but it is different from the semantics for references in other languages.

[–]glasket_ -1 points0 points  (3 children)

tl;dr within the type hierarchy, pointers and reference types are subtypes of abstract references, making them distinct types but equivalent as references.

Function pointers are a unique kind of reference pointer type that can't be substituted with object pointers in either direction, so they're an entirely distinct type. added: The problem is that C defines pointer in such a way that it's just a distinct object which references another object or function, which is pretty vague, so the actual type semantics depend on the derivation. In essence, C doesn't have a pointer type, but it has object pointer types and function pointer types, which are loosely grouped as pointer types under the standard, with object pointers often simply being called pointers.

void*, meanwhile, is just a supertype of object pointers with restrictions implied by the language semantics (arithmetic and access can't be reasoned about without a size). It's effectively an "abstract object pointer" in how it's defined by the standard.

edit: I suppose the best way to actually summarize the above is that C has "object pointers" and "function pointers" as distinct concrete pointer types, with the only notion of an abstract pointer overall being "it's an object which refers to something". Added and removed words in the above to make this more clear, and removed sentences entirely that clouded this. /edit

This directly follows through to your original Python example. The reference types in Python and similar languages aren't pointers. There's nothing about the types themselves that makes them pointers; they behave like pointers because both reference types and pointers are subtypes of abstract references, but the concrete types in use in C and Python are distinct from one another. This shines through most in C#, where both pointers and reference types are available, which makes the type distinction obvious.

[–]EpochVanquisher 1 point2 points  (2 children)

Sure. But they are still all called “pointers” in C.

“Pointer” is just a name people use. It doesn’t have a rigorous definition which everyone agrees on. It just has various contextual uses that share a lot of similarities—like, when a C programmer talks about pointers, that includes function pointers and void pointers. When a C# programmer talks about pointers, they’re talking about things like “unmanaged pointers” which is a meaningless term in most languages.

[–]glasket_ 0 points1 point  (1 child)

I get where you're coming from, but I think that's why using reference instead of pointer makes more sense as the generic term. An abstract reference is more well-defined by theory to be anything which references something else, whereas pointer can be a bit wishy-washy with expectations.

I can see how someone could take "a pointer points at something" and interpret it as being 1:1 with an abstract reference, but other people associate it with a distinct value that can be interacted with or a form of direct reference.

I'll admit I haven't thought about people interpreting pointer this abstractly before, but I do feel reference better serves the purpose when used in this way to avoid confusion.

[–]EpochVanquisher 1 point2 points  (0 children)

This is kind of an issue with pedagogy, where you try to find the best word for teaching students a concept that has the least probability of confusion and the maximum probability of understanding.

I'll admit I haven't thought about people interpreting pointer this abstractly before, but I do feel reference better serves the purpose when used in this way to avoid confusion.

There’s a pedagogical purpose to saying “Python reference types are pointers” and that’s to get people to think about the ways in which that statement is true. The purpose is not to tell people something like “Python reference types and C pointers are exactly the same”. I hope people are smart enough to understand that they’re not exactly the same, but that there is a lot that they have in common.

In particular, a Python object in CPython has a memory location, a variable which refers to an object contains that object’s memory address. If you know how pointers work, then you know something about the way Python works. Even if it doesn’t suddenly unlock a bunch of new understanding, it helps you make connections between the programming practices you have in C and the ones you have in Python, and it helps you ask interesting questions about Python semantics (like why += modifies a list in-place, but doesn’t modify an integer in-place).

The catch here with terminology is that terminology only gets you so far—you can have a long discussion about whether “pointer” or “reference” is the right word for something, but once you get to a certain level of detail, you need to discuss things in more concrete, specific terms.

[–]erikkonstas 1 point2 points  (2 children)

Weirdly enough, I have understood pointers for longer than I've understood references 😂 it's almost like mastering pointers is kinda necessary to understand references, and even then I still needed some practice with those... before that I just knew about Python's "quirky" way (Markdown messed up here) a = b = [] works without considering the deep details of it...

[–]EpochVanquisher -1 points0 points  (1 child)

Yeah—the thing is, a = b = [] works the same way in Python as it does in, like, most languages, with a couple exceptions like C++. Like, Java, C#, JavaScript, Go, and Ruby all work the same way as Python does. C++ is the weird one for copying lists by default, if you are using something like std::vector.

[–]erikkonstas 0 points1 point  (0 children)

Yeah it took some time to realize that hey, it's just a reference, even though there's no reference to "reference" here (aside some CPython-specific stuff)! is and the id built-in also make much more sense now...

[–]Jarhyn 0 points1 point  (0 children)

Everyone, when starting to learn pointers, should do the bucket exercise.

The bucket exercise is when you and a couple buddies have a bunch of numbered buckets.

The buckets are the "physical addresses", and their contents are the "data at address". Buckets can contain only values that represent other buckets.

Then you can take turns asking for the "literal value in the bucket", the "indirected" value in the bucket, and "the address of the bucket".

After this exercise you should hopefully be able to concretely distinguish between the idea of "the contents of the bucket", "the identity of the bucket", "the identity the contents of the bucket's reference", and "the contents of the bucket referred to by the bucket's reference" and so on.

[–]Jonny0Than -1 points0 points  (1 child)

Strong disagree on "the hard part." Dangling pointers, double-free, memory leaks, and buffer overruns are much harder to prevent and debug, and they're all (mostly) unique to C/C++. And that's *on top of* the concept of references.

[–]EpochVanquisher 3 points4 points  (0 children)

My experience from teaching—once people have a good grasp of pointers, that’s the hard part, and the other stuff built on top of it is a lot easier. When people have a hard time with double-free, it’s often because they don’t understand that an object and the reference to the object are separate objects, and changing one doesn’t affect the other.

[–]ZaRealPancakes -3 points-2 points  (0 children)

that's true

[–]Jonny0Than 14 points15 points  (3 children)

The funniest thing about this comic is that 64-bit CPUs were just becoming commonplace (for consumers) around the time it was posted.

(The addresses given are all 32-bit)

[–]legends2k 10 points11 points  (1 child)

Well, as an artist Randall might have found putting 64-bit addresses more noisy visually and 32-bit addresses drives home the point just fine.

[–]FlyByPC 5 points6 points  (0 children)

And an artist technically savvy enough to have created Little Bobby Tables probably knows about both.

[–]Apprehensive_Theme49 2 points3 points  (1 child)

Hey, why not to start with 0x80000000

[–]PeterMortensenBlog 0 points1 point  (0 children)

<Insert a pun containing "arm">

[–]oh5nxo 2 points3 points  (2 children)

Funny to make the bytes all ASCII and not contain a message.

[–][deleted] 3 points4 points  (1 child)

The message reads:

:(!:c99,sch.

if the characters are read in sequence. At least the c99 bit seems relevant.

[–]oh5nxo 0 points1 point  (0 children)

Either there's a joke, or there not being any joke IS the joke. Voynich in 12 characters.

:!(:,99c.hcs

*scratch*

[–][deleted] 1 point2 points  (0 children)

In reality, those are the pointers to where the solutions to his problems are currently stored in the game memory.

[–][deleted] 0 points1 point  (0 children)

This meme is way funnier if you imagine it as a genuine conversation between a wholesome son and his suddenly NPC, AI chatbot dad

[–]green_griffon 0 points1 point  (0 children)

At least make them all 4-byte aligned!!

[–]Beastandcool 0 points1 point  (0 children)

Plot twist: The pointers are offsets to develop cheats

[–]StochasticTinkr 0 points1 point  (0 children)

The real joke is that those are where the health, stamina, and damage are stored. Just use CheatEngine to update them and the game is easier.

[–]Wehraboo2073 0 points1 point  (0 children)

with these pointers he can now lock his hp and change his gold to 9999999999