Nah, she's 5 or younger. She lied about being 6 (school age) to get adopted. It's a very wholesome story (if you disregard the war, political intrigue and terrorism).
int** is inside a TV, and persumably int* must be inside another TV(even though uts not edited in). The image perespective is showing one thing inside the other, inside the other. So when when int*** points the TV it reference int**, which reference int* which reference int. Its just edited very bad
RT*** isn't pointing at RT*, he's pointing at the TV showing RT**. The fact you think otherwise is what makes the image unclear. I'm not sure why you insist on them being wrong.
Unlike many other programming languages, which are often picked up on the go from tutorials found on the Internet, few are able to quickly pick up C++ without studying a well-written C++ book. It is way too big and complex for doing this. In fact, it is so big and complex, that there are very many very bad C++ books out there. And we are not talking about bad style, but things like sporting glaringly obvious factual errors and promoting abysmally bad programming styles.
This would be incredibly hazardous to pass around as a bare pointer with no context, though. I'd expect to see this in a struct that, at minimum, also includes fields for the size of each dimension.
In the C programming language. Or do you mean which C project specifically? Because as Technus surmises in their response, it's usually a better idea to set up aliases (typedefs or heck, even #defines) so that you're offloading some of the mental strain keeping track of the layers, and that's likely to be what happens in production code.
As someone who likes working with higher level languages, I never understood the pass by reference or even referencing different pointers. It never stuck out to me as useful in what I want software to do. It’s too close to hardware.
if you're working with higher level languages you pass-by-reference all the time. give a list to a function to modify it? that's by reference. giving an event handler function to a framework? that's by reference. setting a property on an object? that's usually by reference.
Your example doesn't make sense to me. Why would you modify the entire list by checking if something is in it? Also, you can totally edit the list via a pointer, that's how you're supposed to edit the list if you want any performance. Otherwise you'd be copying the list on every modification, which is terribly inefficient
A pointer to the list would allow you to modify whatever's at that pointer's address though. If you want to look at the list and not edit it you pass by const reference 99% of the time (or you pass a copy) and if your language doesn't have that I don't like it.
I want my language to pass by reference. I give a variable to a function and the variable in the function scope should be a reference to the same place in memory as the original variable.
How can pointers help me here? What value does it provide? Genuine question.
I want my language to pass by reference. I give a variable to a function and the variable in the function scope should be a reference to the same place in memory as the original variable.
I'm not even a C++ wizard or anything (though it's my most advanced language) so I'm not gonna argue that is good or bad, that sounds fine to me for a wide range of applications already.
But the way is see it, pointers kinda allow you to use "raw memory" which is an actual thing that's gonna be handled by the program one way or another, and it's a way to relatively refer to memory for example. As some guy on stackoverflow put it "That guy at the end for the bar" vs "Bob" can be very useful. Especially when using data structures you don't know the size of at compile time.
Most of the time you pass by reference for more outputs, or by const ref to avoid copying a big-ass data structure (which is not always straightforward, with structures smaller than a pointer, which are pretty big in 64 bits architecture, you lose more to the ref overhead than to the copy IIRC)
The placement of the labels is a bit sloppy but I think it tracks. The character in the middle (int*) is pointing at int, then the one on the left (int**) is pointing at the middle one (int*), etc
What I want to know: what is that shirt and where do I get it?
So it's like a mystical artifact of the computational Big Bang? You deref a pointer to the very beginning of Unix time and bam, suddenly you're styling like Richard Stallman?
77 Comments
lime@feddit.nu · 108 pts · 76d
they used to call him the deref king back in college
lian_drake@lemmy.world · 73 pts · 75d
Worse version of this
ZILtoid1991@lemmy.world · 6 pts · 75d
Null termination is no longer recommended, use fat pointers instead!
mbp@slrpnk.net · 3 pts · 75d
Why would I want to be shown the concept of pointers by an eight year old?
WrathEnchanter@europe.pub · 15 pts · 75d
I'll have you know, she's canonically 300 years old
wieson@feddit.org · 15 pts · 75d
Nah, she's 5 or younger. She lied about being 6 (school age) to get adopted. It's a very wholesome story (if you disregard the war, political intrigue and terrorism).
mnemonicmonkeys@sh.itjust.works · 5 pts · 75d
And the fact that Anya's best friend is trying to break up Anya's parents because she has a crush on the dad
HeyThisIsntTheYMCA@lemmy.world · 1 pts · 74d
Hey if you knew Lloyd and not Yor you might do the same. Dudes a hottie.
HeyThisIsntTheYMCA@lemmy.world · 2 pts · 74d
El terrorismo makes it more holesome.
WrathEnchanter@europe.pub · 2 pts · 74d
I was just making a joke
mbp@slrpnk.net · 2 pts · 75d
🙄
rizzothesmall@sh.itjust.works · 5 pts · 75d
It's a good reference (lol) even if it's getting downvoted
hoohoohoot@fedinsfw.app · 0 pts · 41d
NullPointerException@lemmy.ca · 67 pts · 76d
Wait. It’s been a long time but shouldn’t be int*** -> int** -> int* -> int ?
Susaga@sh.itjust.works · 83 pts · 76d
I think int*** is meant to be pointing at int**, but the image is just unclear about where everything is in perspective.
dohpaz42@lemmy.world · 28 pts · 75d
Pretty sure the image is clear:
Clarity doesn’t mean correct. But that’s probably why it’s posted here. 🤷♂️
mexicancartel@lemmy.dbzer0.com · 9 pts · 75d
int** is inside a TV, and persumably int* must be inside another TV(even though uts not edited in). The image perespective is showing one thing inside the other, inside the other. So when when int*** points the TV it reference int**, which reference int* which reference int. Its just edited very bad
Susaga@sh.itjust.works · 8 pts · 75d
RT*** isn't pointing at RT*, he's pointing at the TV showing RT**. The fact you think otherwise is what makes the image unclear. I'm not sure why you insist on them being wrong.
_tasten_tiger@feddit.org · 0 pts · 73d
But that doesn't hold up, because RT** isn't pointing at a TV containing RT* only RT*** is pointing at an TV containing RT** RT* and RT
MonkderVierte@lemmy.zip · 2 pts · 75d
What's the * for again?
Monument@piefed.world · 4 pts · 75d
It’s to check to see if commenters know how to escape the symbol. Congratulations! You passed!
Source: I made it up.
MonkderVierte@lemmy.zip · 5 pts · 75d
You don't need to escape standalone *. At least not on Lemmy.
Monument@piefed.world · 3 pts · 75d
Well, I thought my misinformation was funny.
Valmond@lemmy.dbzer0.com · 2 pts · 74d
You can't escape it, it will always get you.
HeyThisIsntTheYMCA@lemmy.world · 2 pts · 74d
That one's a typo
obviouspornalt@fedinsfw.app · 15 pts · 75d
I mean, that's pretty much what happens to me every time I try to use pointers, so the meme checks out.
Quibblekrust@thelemmy.club · 7 pts · 75d
terranoid@lemmy.cafe · 7 pts · 76d
yep this is just someone misunderstanding pointers lol
Dialectical_Specialist@quokk.au · 3 pts · 75d
That's not the end of the chain either, right?
Because : int -> &int -> &&int
Or can you not use the address operator like that? It also might be int& &, I failed cs2200 on this exact type of technicality
DrCake@lemmy.world · 41 pts · 76d
Rumble Tumble Games in the wild
MrQuallzin@pie.eyeofthestorm.place · 12 pts · 75d
Seeing him break containment is wild
MrNesser@lemmy.world · 30 pts · 75d
Didn't expect to see the Drift King here
Jumi@lemmy.world · 9 pts · 75d
Drift King? You mean Dan the Villian
dangrousperson@feddit.org · 11 pts · 75d
as a python script kiddie, this is way over my head, but upvoted because of RT Game
14th_cylon@lemmy.zip · 8 pts · 76d
Why should the left one in the rectangle be int**? It doesn't make sense to me, they are both clearly just int*
What am i missing?
ImgurRefugee114@reddthat.com · 9 pts · 76d
I they're supposed to be pointing at each other but the edit didn't really work because his arm is pointing too far away
Skipcast@lemmy.world · 4 pts · 75d
Perspective innit
MonkderVierte@lemmy.zip · 8 pts · 75d
So, googling it, the general premise is you should use smart pointers instead to avoid crashes. Got it.
DahGangalang@infosec.pub · 10 pts · 75d
Smart pointers implies C++, which is not the right answer.
MonkderVierte@lemmy.zip · 6 pts · 75d
https://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list
mnemonicmonkeys@sh.itjust.works · 6 pts · 75d
Considering that most of the "answers" I've found on StackOverflow were complete dogshit, I'm wary of this reading list
HeyThisIsntTheYMCA@lemmy.world · 5 pts · 74d
Uh

I think I'll just let the cat drive instead
CanadaPlus@lemmy.sdf.org · 4 pts · 75d
They all have footguns that cause different crashes.
If you want to do explicit memory access without inevitable safety problems, you need Rust. That's the whole hype with Rust.
MonkderVierte@lemmy.zip · 1 pts · 74d
But... per-process-isolation is a hardware feature, no?
CanadaPlus@lemmy.sdf.org · 2 pts · 74d
Sure, that may be (it's definitely not in userspace). But don't forget it works by crashing your program.
psud@aussie.zone · 2 pts · 71d
So you really should implement it in your compiler so you don't contravene it
Technus@lemmy.zip · 7 pts · 76d
Real talk: is there any practical use-case for
T***of any pointee type?palordrolap@fedia.io · 22 pts · 76d
Dynamically allocated multidimensional arrays.
Technus@lemmy.zip · 12 pts · 75d
Ah right, so that would be a 3D array.
T*is a single row ofTT**is a list of rowsT***is a list of "layers" in the third dimensionThis would be incredibly hazardous to pass around as a bare pointer with no context, though. I'd expect to see this in a
structthat, at minimum, also includes fields for the size of each dimension.BartyDeCanter@piefed.social · 8 pts · 75d
This
SpartaC. We live for danger.Auth@lemmy.world · 8 pts · 75d
Tesseract Array
MonkderVierte@lemmy.zip · 1 pts · 75d
Where?
palordrolap@fedia.io · 3 pts · 75d
In the C programming language. Or do you mean which C project specifically? Because as Technus surmises in their response, it's usually a better idea to set up aliases (
typedefs or heck, even#defines) so that you're offloading some of the mental strain keeping track of the layers, and that's likely to be what happens in production code.But the underlying data type is still
T***.MonkderVierte@lemmy.zip · 1 pts · 75d
LovableSidekick@lemmy.world · 5 pts · 75d
C# delegates enter the chat and nod.
Flames5123@sh.itjust.works · 4 pts · 75d
Now that explain the & part of the pointers that I never really understood.
ZILtoid1991@lemmy.world · 6 pts · 75d
The
&operator references the value.In C++, the
&at the function argument makes it a reference type (safe pointer).Flames5123@sh.itjust.works · 1 pts · 75d
As someone who likes working with higher level languages, I never understood the pass by reference or even referencing different pointers. It never stuck out to me as useful in what I want software to do. It’s too close to hardware.
lime@feddit.nu · 10 pts · 75d
if you're working with higher level languages you pass-by-reference all the time. give a list to a function to modify it? that's by reference. giving an event handler function to a framework? that's by reference. setting a property on an object? that's usually by reference.
funkless_eck@sh.itjust.works · 0 pts · 75d
the list is the helpful part to understanding it.
it would be terrible if, with bar being a list and foo being a member of the list
modified the list. So yeah, you want to look at the list not edit the list, it's a pointer.
lime@feddit.nu · 4 pts · 75d
other way round surely? if you want to modify the original object, use a pointer. if you don't, use a copy.
gerryflap@feddit.nl · 2 pts · 75d
Your example doesn't make sense to me. Why would you modify the entire list by checking if something is in it? Also, you can totally edit the list via a pointer, that's how you're supposed to edit the list if you want any performance. Otherwise you'd be copying the list on every modification, which is terribly inefficient
Sylvartas@lemmy.dbzer0.com · 1 pts · 75d
A pointer to the list would allow you to modify whatever's at that pointer's address though. If you want to look at the list and not edit it you pass by const reference 99% of the time (or you pass a copy) and if your language doesn't have that I don't like it.
captcha_incorrect@lemmy.world · 2 pts · 75d
I still don't get the point of pointers.
I want my language to pass by reference. I give a variable to a function and the variable in the function scope should be a reference to the same place in memory as the original variable.
How can pointers help me here? What value does it provide? Genuine question.
Sylvartas@lemmy.dbzer0.com · 2 pts · 75d
I'm not even a C++ wizard or anything (though it's my most advanced language) so I'm not gonna argue that is good or bad, that sounds fine to me for a wide range of applications already.
But the way is see it, pointers kinda allow you to use "raw memory" which is an actual thing that's gonna be handled by the program one way or another, and it's a way to relatively refer to memory for example. As some guy on stackoverflow put it "That guy at the end for the bar" vs "Bob" can be very useful. Especially when using data structures you don't know the size of at compile time.
Sylvartas@lemmy.dbzer0.com · 10 pts · 75d
Most of the time you pass by reference for more outputs, or by const ref to avoid copying a big-ass data structure (which is not always straightforward, with structures smaller than a pointer, which are pretty big in 64 bits architecture, you lose more to the ref overhead than to the copy IIRC)
DahGangalang@infosec.pub · 4 pts · 75d
Another reason I commonly see: to change the structure / "main pointer" to a data structure (esp during freeing and cleanup).
ZILtoid1991@lemmy.world · 1 pts · 75d
Reference values are quite useful, such as:
dejected_warp_core@lemmy.world · 4 pts · 75d
*x = dereference or "point to". Treats the variable
xas containing a pointer value. Evaluates to a variable existing at the address inx.&x = reference or "get address of". Evaluates to the address of
x.They're complimentary operators, so
*(&x)cancels out and is equvalent to justx.refalo@programming.dev · 4 pts · 74d
that's not LaurieWired
Quibblekrust@thelemmy.club · 4 pts · 75d
Am I a computer scientist now?
ZILtoid1991@lemmy.world · 0 pts · 75d
No, you need to learn a lot more. Other programming concepts, programming paradigms, algorithms, and many more.
HeyThisIsntTheYMCA@lemmy.world · 3 pts · 74d
Uh I'm a charisma class (with unfortunate base stats) what's int
zerofk@lemmy.zip · 3 pts · 74d
It’s what makes mages turn those squiggly lines on paper into fireballs.
Not clerics though, they’re different.
Deconceptualist@leminal.space · 3 pts · 75d
The placement of the labels is a bit sloppy but I think it tracks. The character in the middle (int*) is pointing at int, then the one on the left (int**) is pointing at the middle one (int*), etc
What I want to know: what is that shirt and where do I get it?
addie@feddit.uk · 2 pts · 75d
He dereferenced a pointer to the 1970s and retrieved the shirt that way.
Deconceptualist@leminal.space · 2 pts · 75d
So it's like a mystical artifact of the computational Big Bang? You deref a pointer to the very beginning of Unix time and bam, suddenly you're styling like Richard Stallman?
itkovian@lemmy.world · 3 pts · 75d
So, confusing, nonetheless.