K
Karl Heinz Buchegger
in other words according to the standard
unsigned char* some_random_address = 0xabc12345;
has undefined behavior becase it doesn't point to an array element or
one past the array...
Exactly
It simply means that I cannot have a pointer to
an arbitrary element in memory (even if no such area addressable etc
etc, but I just cannot have an arbitraty address)?, it seems to be very
strange if not ridiculous.
No. It does not mean that you cannot have such a pointer.
It simply means that your compiler or the hardware may do something
strange to that pointer value. You better check your compilers
documentation what it does with that pointer because the language
standard cannot guarantee for anything. Not even that such a pointer
value can be formed.
If programming in asembler there's no
difference wether a pointer points to first, last, arbitrary memory, 0,
0-1 ...
But you are not programming in assembler.
Assembler is by the very nature of it always bound to the CPU
and the operating system you are programming for.
C and C++, as defined in the language standard, free themselfs from
that, so everything CPU and operating system dependent cannot be
guaranteed. That includes if you can form such a pointer and what
derferencing such a pointer leads to.