Signed word lengths and indexes

Michel Fortin michel.fortin at michelf.com
Fri Jun 18 05:40:07 PDT 2010


On 2010-06-18 08:11:00 -0400, bearophile <bearophileHUGS at lycos.com> said:

> 4.13 Arrays of Length Zero: they are available in D, but you get a 
> array bound error if you try to use them to create variable-length 
> structs. So to use them you have to to overload the opIndex and 
> opIndexAssign of the struct...

Bypassing bound checks is as easy as appending ".ptr":

	staticArray.ptr[10]; // no bound check

Make an alias to the static array's ptr property if you prefer not to 
have to write .ptr all the time.

-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/



More information about the Digitalmars-d mailing list