??? 01/01/11 19:20 Read: times |
#180385 - Big difference in concept - C actually unusual Responding to: ???'s previous message |
Note that Pascal don't have pointer arithmetic.
And it doesn't make arrays look like pointers or pointers look like arrays. And arrays have bounds checking. And until Turbo Pascal, you didn't had a chance to play with pointer types. There really is a huge difference with pointers in C compared to most other languages because of the freedom a developer has to manipulate them. That is why some other languages are marked with the somewhat shady claim that they don't have pointers. They talk about references instead, but the basic difference is in how you are allowed to assign values to them and that you can't do arithmetic with them. But you still get null pointer exceptions, which is a very common failure for .NET and Java applications. BASIC don't really need pointers in the normal sence since it has so different views of variables. Just as with references, you don't really see in the code if you access data directly or using a pointer. For most part, you normally get built-in functions that do hw-related actions. But some dialects have constructs to allow you to map your variables - needed in Visual Basic to allow access to some OS API or when interfacing with other languages. C really is quite uncommon when it comes to pointers. That is a weaknes. But also one of the reasons why C works so well to map to traditional hardware. Traditional processor architectures has assembler instructions that are very much based on direct and indirect addressing modes, and the raw pointer implementation in C can make use of this. |