New testcase

Richard Earnshaw rearnsha@arm.com
Tue Nov 14 07:42:00 GMT 2000


Well, I only have a c9x draft to hand, but it says (6.5.6 Additive 
operators):

9 When two pointers are subtracted, both shall point to elements of the 
same array object, or one past the last element of the array object; the 
result is the difference of the subscripts of the two array elements.

Which means, of course, that an implementation on a segmented memory 
architecture could, if it wished, put each object in a separate segment.  
It could then fault any attempt to subtract pointers where the segment 
pointers were different.

>   I'd have to look this up. I thought there was an exclusion for char
> types, or possibly only unsigned char. You're allowed to do all sorts
> of things with char pointers that aren't permitted with other types, and
> the standard also makes guarantees about the underlying representability
> of objects as arrays of unsigned char... I'd have to look it up.
> 
>  BTW, owing to ORBS problems this reply won't make it to the list. You
> could Fw: it if you think it would be worthwhile.

R.



More information about the Gcc-patches mailing list