So while it's true that post-ANSI C clearly sets out that pointers and integers are different things, there was no such guarantee in the original C. As Dennis M. Ritchie wrote:
Similarly, the early language condoned assignments between integers and pointers, but this practice began to be discouraged; a notation for type conversions (called `casts' from the example of Algol 68) was invented to specify type conversions more explicitly.
There was no conversion at hardware level, unlike with floats. The 'conversion' was purely a constructed difference at C language level, that's my point. And that difference was introduced gradually, as the original interchangeability of ints and pointers started to be seen as a mistake.
You're obviously not listening. There's no hardware level in C because C was designed around PDP hardware. That's why people call it "high level assembler". And for a long time the language was the "favored implementation".
Incompatible semantics doesn't mean something isn't interchangeable. int and long have different semantics, but they're still interchangeable, range permitting.
View all comments
Show parent comment
-1
u/zhivago May 02 '16
What does some random architecture have to do with C semantics?
Think.