specifying ranges (in noalias constraints)

Thomas M. Breuel uunet!ai.mit.edu!tmb
Mon Oct 21 22:28:56 PDT 1991


|> Here are two possible approaches [to specifying noalias constraints]:
|> 
|> 	void *na_memcpy(void *s1, const void *s2, size_t n, 
|> 			__noalias__(s1[0..(n-1)],s2[0..(n-1)]) ));

If anything, this should probably be 

	void *na_memcpy(void *s1, const void *s2, size_t n, 
			__noalias__(s1[0..n],s2[0..n]) ));

So, the specification "0..n" should refer to the set of integers
"{0,...,n-1}". The notation "0..(n-1)" for this set is contrary to the
usual conventions used in C (and in several other modern programming
languages); the current trend seems to be towards ranges that are 
inclusive at the low end and exclusive at the high end. See, among 
others, CLtL for a rationale.

					Thomas.



More information about the Numeric-interest mailing list