|
Pointers are evil...
...evil is fun.
"In testa che avete, Signor di Ceprano?"
-- Rigoletto
|
|
|
|
|
But they're so cute and cuddly. Especially my precious little void*. Who's a good little typeless pointer? YOU ARE!
Real programmers use butterflies
|
|
|
|
|
Quote: Especially my precious little void*
No, that's the Mother Of All The Evil, and your really don't need it in C++ .
"In testa che avete, Signor di Ceprano?"
-- Rigoletto
|
|
|
|
|
I guess your article should point that out
|
|
|
|
|
I remember learning pointers being a real "light bulb" type of learning experience for me.
I felt like I was banging my head against a wall trying to figure them out, then with a single revelation, they suddenly made complete sense to me. I've never been able to figure out what caused that revelation.
|
|
|
|
|
I've had several of those epiphanies in development over the years. Like when I finally understood COM on its terms (a binary vtbl based contract)
I really enjoy them. I can't remember if pointers was one because it was so long ago.
Real programmers use butterflies
|
|
|
|
|
I know what you mean, but my "pointer epiphany" was memorable enough to still be clear to me more than 30 years later... now if I could just remember where I put my glasses.
|
|
|
|
|
the C abstract machine
there is no problem with pointers if you look straight at them. the problem is when somebody tries to wrap them in some obscured "politically correct" story that doesn't hurt a chipmunk if you step on it.
i know this line is confusing, but Pascal was my first programing language and when the time came to grow up and use pointers normally i reached for a Pascal programming book...
well, that book in it's chapter of pointers had everything else, about lists, about binary trees... but i could not tell what pointers are.
i mean, the person who wrote that book constantly repeated how pointers are really useful although you should avoid to use them as much as possible... he doesn't know about pointers.
then i read a chapter about pointers from a C tutorial and everything became crystal clear. there was i happy and using pointers in Pascal.
the same thing was with win32 programming. you can not learn it from a Delphi book, you need a C book for that. but you can sure as hell do that in Pascal as good (or better) as in C if you learn the right way.
pointers are a fundamental thing. the 8086 processor has a few general purpose registers and about the same number of Index registers. out of this bunch SI and DI are your pointers.
and i bet you will understand pointers even better if you learn assembly than C, but C is good enough.
|
|
|
|
|
I first used pointers in asm, because it was the first thing other than basic i could really write code in for the 6502. I learned C later. I'm fine with them. it seems many other people aren't, hence the idea for the article.
Real programmers use butterflies
|
|
|
|
|
yeah, i was on the 6502 too. the most close to pointers out of the top of my head was this addressing mode like: lda ($fb),y or lda ($fb,x)
hell, i don't even remember was there a comma or a dot in front of the index register. much less how these two modes were called.
|
|
|
|
|
YAY the bad old days!
Real programmers use butterflies
|
|
|
|
|
it seems many other people aren't, hence the idea for the article.
than it's just a matter of time. just do it!
|
|
|
|
|
I think I would agree that pointers are quite intuitive, but I still prefer the way Java, for example, takes away the need to deal with them directly, though one still ought to understand what is happening under the hood. Constructing a linked list in Java takes away the need to think about pointers at all (so be careful those who use this as an interview Q). I like languages which allow me to spend more cognition on the business logic rather than its implementation. Also, modern compilers can implement code better than most (if not all) of us humans can. That said, there is something aesthetic about pointers, more so when you deal with memory management in assembly langauge. I quite like the fact that C lets you get to grips with these lower level devices, though in my work it's more of an aesthetic curiosity than a necessity to know these things.
|
|
|
|
|
I tend to agree ... until I don't. That is to say, I appreciate not having to deal with them until I'm given occasion to miss them. Sometimes - and I find quite often in C and C++, there's a much more elegant and/or efficient solution to be had using pointers than working without them.
I tend to like the STL because it takes away the need for pointers, but doesn't prevent you from using them.
Real programmers use butterflies
|
|
|
|
|
I'm in two minds on that: it is certainly nice when coding to have options and 'power' to operate at a lower level when it seems like a good idea, but historically the misuse of pointers by programmers caused absolute havoc.
|
|
|
|
|
24 hours ahead of schedule (and a year behind at the same time): The Grand Tour: A Massive Hunt[^] is finally out on Prime.
Yay!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I would watch it nob, but I'm at work. I suppose I'll spend some time this weekend catchin' up with those three.
|
|
|
|
|
Rats! I thought you were referring to The Expanse, but then I remembered I already watched episode 1 of season 5!
Get me coffee and no one gets hurt!
|
|
|
|
|
You do realize they dropped S05E01...S05E03 incl. yesterday?
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Yes, but Herself rationed my time to watch one episode a day. We are taking care of the grandkids during the day, then I am not allowed to watch TE due to the violence and bad language.
Get me coffee and no one gets hurt!
|
|
|
|
|
There is no violence and bad language in The Expanse.
There is a lot of violence and appropriate language!
I was watching a dashcam video on Youtube a week or so ago, and a car on the other carriageway just dived up a bank, fell over, and rolled across the road in front of the camera car.
The drivers voice just went "F*******ck!"
And a little voice chimed in from the back: "What does that mean Mommy?"
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
My kid and I watched it last night. Started out good, then became disappointing.
I did like that the boys were getting along better.
|
|
|
|
|
std::brexit(0); // does this really terminate the process?
"If we don't change direction, we'll end up where we're going"
|
|
|
|
|
No, it enters an infinite loop.
|
|
|
|
|
Maybe if you change the parameter to €5,000,000,000.
|
|
|
|