|
And, as any hungry lion or tiger can tell you:
"They're slow. No claws. No fangs. And you don't even get much hair stuck in your teeth."
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
This site already has quite a few articles about pointers. I haven't read any of them, but some have been favorably received. Maybe looking at some of them would give you ideas as to what more you could say.
|
|
|
|
|
Do they allow fiction writing on CP?
I'm not sure how many cookies it makes to be happy, but so far it's not 27.
JaxCoder.com
|
|
|
|
|
What's so confusing about them? They point to a memory location. Think of an address as an index into a big array of bytes. No big. =)
Real programmers use butterflies
|
|
|
|
|
In a way, back to what you noted in your original post:
How different people just see and understand things differently.
Way back in elementary school (do they still have that?) I was exceptionally good in math, and by second grade, reading. Science was a joy. Handwriting, to this day, childlike. Also, despite being able to express myself bother verbally and in written prose with some eloquence (when the mood shines), when being taught grammar (as in parts-of-speech), the more they taught the less I knew. Associating names and faces, and pure memorization in general is a horror for me - but I know where things were in (for example) a 60,000 line application I wrote some many years ago.
I had no trouble with C pointers because I learned assembly, first. I've heard that normally it can be quite a thing to grasp for learning C for those who haven't been elsewhere introduced.
The point (ah yes, yet another pun) is that we all get dealt a hand and play those cards as best we can - at least for some of us.
So - and this works out well for us as we're a herd-species - we all have different expertise and shortcomings that, when melded within the group, form a gestalt.
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
...and that, right there, is pretty much all you need to know.
For some reason I was overthinking the whole thing when I started learning about them. And it's only like 2 years into college that I finally wrapped my head around the whole, basic, fundamental idea. Never had a problem with them since.
That being said, I haven't done anything pointer-related in over a decade...
|
|
|
|
|
I think that's a common trap. It doesn't help that misusing them causes faults because I think that makes them intimidating but all a fault is is an unhandled exception. Fear is a huge stumbling block to growth.
It doesn't help that I've seen lots of articles (not necessarily here) rag on pointers and state that they're scary in so many words, probably from authors that never got comfortable with them themselves.
A lot of times it's no different than accessing an array.
Real programmers use butterflies
|
|
|
|
|
probably from authors that never got comfortable with them themselves.
or maybe got paid to support some language that is safe (secure).
security or the opposite of it, fear, sells a lot in modern times.
i don't know what is it these days, but everyone is trying to jump on you with a zealot yelling that you are doing something wrong. that you're incompetent. loser. that they are going to open your eyes with this new way, new programming language, new framework...
ok, i get that. these are lamer times. instead of friendship there is mostly ridicule, which makes everybody look bad in the eye of the beholder.
although new or old things have interesting ideas, nothing is black and white.
"if somebody is selling you a technique in convincing you that there is something that you should do, they're focusing on the benefits and they are either gonna be downplaying the drawbacks or they'll be ignoring them completely" - Jonathan Blow on Software Quality at the CSUA GM2
|
|
|
|
|
Pointers are powerful and easy to use can lead to disaster when not used correctly, as can be seen when trying to debug a pointer problem.
I'm not sure how many cookies it makes to be happy, but so far it's not 27.
JaxCoder.com
|
|
|
|
|
Yeah. There is that. It's easier to use them correctly though if you understand them intuitively.
These days most of my pointer problems are caused by things i forget to initialize.
Real programmers use butterflies
|
|
|
|
|
Quote: Pointers are powerful and easy to use can lead to disaster when not used correctly, as can be seen when trying to debug a pointer problem.
Anyone trying to debug pointer problems without using valgrind is probably a masochist.
|
|
|
|
|
Had never heard of Valgrind.
I'm not sure how many cookies it makes to be happy, but so far it's not 27.
JaxCoder.com
|
|
|
|
|
Honey, that is exactly why they are confusing! The problem is English and the really sloppy way programmers use English!
Pointers do not actually "point" to a memory location. The fact that you can get to a data element in memory and that method that can be manipulated as if it were a number is a *compiler specific concept* in the C family of languages. And an incredibly stupid idea that creates tons of security vulnerabilities. NEVER, EVER use a pointer as if it were a number. ALWAYS use it as an abstract data type and you will avoid 99.9% of pointer type defects in your code.
I am mentoring a young woman who is taking her first real programming class (Python *DOES NOT* count).
---------------
Here is what I told her:
Anyone who has ever written in a "proper" language like Pascal, Modula, PLM-86, or Ada or who studied actual Computer Science will tell you that a "pointer" is an abstract data type that is nothing more than a handle to some object in your program. There are *NO* operations defined for a pointer other than connection to some object, referencing an object (either an actual object in C++, C#, Ada, etc. or a struct or intrinsic in C) or copying a pointer to another pointer of the same type. You can literally use a "pointer" as a handle to carry data around in your program from one place to another. In some languages we use the word "reference" as a synonym for a pointer.
I also gave her a physical example of how pointers can be used in linked lists.
----------------
Kernighan and Ritchie (bless their hearts) improperly called a data type by the CS name "pointer" when they should have named it an "address". They ARE NOT the same thing. In modern computers, that is absolutely the case because the "address" you get is just a virtual mapping of an actual address to some other thing that just happens to be a number (but you have to understand hardware to understand why that is). K&R (or some folks after them) also screwed up the keyword "static" which has two *completely different* meanings depending on context. The list of things screwed up in C is a long one! It is why the MISRA standard is necessary.
C was just readable assembly language for the PDP-11 computer which got moved over time to other computers. Because you are forced on very small computers to play tricks in C/assembler in order to save data and code space, C has some really egregious history of confusing pointers with addresses and the fact that you can actually see a *real* computer underneath the virtual computer. The way to solve that problem: NEVER, EVER use a pointer as if it is an address or a number even if the language allows you to do it.
Just because you *can* do a thing does not mean you *should* do that thing. (Someone on this board has that thought from Jurrasic Park as his signature)
|
|
|
|
|
They're not confusing at all.
( I removed the link )
use the wikipedia instead : Pointer (dog breed) - Wikipedia
I'd rather be phishing!
modified 17-Dec-20 17:06pm.
|
|
|
|
|
My antivirus started to ring bells with that link.
Just in case, don't visit it.
https://static.searchiq.cc/js/2.2.57/sa.js
Name of the thread: JS:Trojan.JS.Downloader.DOY
Really sad if we can't trust the links of other old CPians in the lounge to webs that shouldn't be dangerous
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
weird, it passed out over zealous web nanny on my office computer.
I removed the link and put the wikipedia link instead.
I'd rather be phishing!
|
|
|
|
|
I suppose it was a google ad or similar...
they don't necessarily have to be the same for you as for me or when you took the link as to when I visited the site.
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
I thought about that pointer, yesterday, but thought it would destroy the tattered remains of my reputation. Perhaps that is why you can use a pointer to fetch data.
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
That points me to.... ääähm.... no can't explain it
It does not solve my Problem, but it answers my question
Chemists have exactly one rule: there are only exceptions
modified 19-Jan-21 21:04pm.
|
|
|
|
|
The most famous pointer of them all is ... Google.
How?
Well, given a search string, Google points us to the location(s), meaning website(s), where that search string is present. Agree?
|
|
|
|
|
Amarnath S wrote: Well, given a search string, Google points us to the location(s), meaning website(s), where that search string is present. Agree?
If you're lucky...
Anything that is unrelated to elephants is irrelephant Anonymous
- The problem with quotes on the internet is that you can never tell if they're genuine Winston Churchill, 1944
- Never argue with a fool. Onlookers may not be able to tell the difference. Mark Twain
|
|
|
|
|
I'd say the links it returns are the pointers, but you do you.
Real programmers use butterflies
|
|
|
|
|
honey the codewitch wrote: links it returns are the pointers
So is Google a pointer factory, or a pointer dictionary?
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
That's a fantastic question.
Real programmers use butterflies
|
|
|
|
|
How hard can a pointer be? It points to a chunk of memory with stuff in it. Keep that fundamental concept in mind at all times and you shouldn't have any problems.
- I would love to change the world, but they won’t give me the source code.
|
|
|
|