About Pointers

My teacher in school told me that we shouldn't use pointers since they make the program platform dependent.
Since I haven't heard about this anywhere else.
So,
Is this true?
Last edited on
No, pointers are not platform dependent at all unless you do stupid stuff that you shouldn't be doing with them. I don't know where they got that from...
What's that stupid stuff?
I think, it may be because we are learning prehistoric C++?
We have to use the Borland Turbo C++ Compiler (I dislike even the look of it)!
Mmm Borland is very old and outdated, indeed. I think what firedraco is getting at is assuming certain addresses have certain meanings, as opposed to using pointers 'normally' to access arrays or other variables you own.
Actually even with "higher level languages" like Java, the underlying is using memory addressing of some sorts like pointers. But such low level access are not exposed to Java programmers. So to Java programmers, it is like pointers have "disappeared".

Maybe try asking those Java Virtual Machine developers and see if they need to deal with pointers or not :)

Btw, the number of developers involved in JVM implementation are pretty low world-wide in comparison to Java developers so I don't know if we can know anyone of them surf this forum.
Ok, but I'm not sure how that relates as TC is talking about C++.
Pointers are variables which store a memory address. They do not make your program "platform dependent" any more than the actual compiler does.
closed account (z05DSL3A)
Pointers are variables which store a memory address.

Are all pointer the same on all platforms? Size for example. What about the memory model of the platforms. Borland Turbo C++ Compiler is a very old compiler for a system where such things matter.
Topic archived. No new replies allowed.