C
c.a.l
a) If i do
pointer = pointer_to_safe_thing - 1000;
pointer[1000] == pointer_to_safe_thing[0];
then
I am *not* accessing invalid memory. Nor i am incorrect in
mathematical sense.
Nevertheless outcome of pointer_to_safe_memory - 1000 operation
yielding pointer may be undefined. For i do not know whether pointers
wraparound like integers?
b) And if i do (lets say array is integer)
intprt_t i;
i = pointer_to_safe_thing - 1000;
(pointer = (int*) (i+1000) ) == pointer_to_safe_thing[0];
then
It should be correct. For integers wraparound (should?).
Am i correct? I feel that it depends on what type of number system
computer uses.
Thank you in advance.
pointer = pointer_to_safe_thing - 1000;
pointer[1000] == pointer_to_safe_thing[0];
then
I am *not* accessing invalid memory. Nor i am incorrect in
mathematical sense.
Nevertheless outcome of pointer_to_safe_memory - 1000 operation
yielding pointer may be undefined. For i do not know whether pointers
wraparound like integers?
b) And if i do (lets say array is integer)
intprt_t i;
i = pointer_to_safe_thing - 1000;
(pointer = (int*) (i+1000) ) == pointer_to_safe_thing[0];
then
It should be correct. For integers wraparound (should?).
Am i correct? I feel that it depends on what type of number system
computer uses.
Thank you in advance.