2 ms·
This isn't quite true, although you need some sort of guarantee on the arithmetic to ensure that each pointer is bounded within an object. C, in theory, allows
by ori_b 11y ago
This isn't quite true, although you need some sort of guarantee on the arithmetic to ensure that each pointer is bounded within an object.
C, in theory, allows this restriction, since computing a pointer to another object and dereferencing it is undefined behavior, but most implementations seem to relax this restriction.
- DonaldFisk 11y agoI think that Symbolics C did have this restriction.
- duaneb 11y ago> This isn't quite true, although you need some sort of guarantee on the arithmetic to ensure that each pointer is bounded within an object. I mean, this isn't pointer arithmetic, this is constrained offset lookup implementing a subset of pointer arithmetic (only addition of numbers >= 0?). I'd argue they're still not pointers unless you can derefence an arbitrary integer.
- ori_b 11y agoThen you're arguing that strictly conforming C code does not have pointers.
- duaneb 11y agoThe semantics of the english here is a little lacking, but I think strictly conforming C code has pointers that behave like references. To my current understanding, this is highly unrealistic, hence ameliorating tooling like address sanitization. To be clear, they would still be called pointers. But when people talk about the complications of pointers, they are referring to non-standard behavior which is necessary with today's C code (and pretty much all historic C code).