Slicing to convert pointers to bound arrays

bearophile bearophileHUGS at lycos.com
Sat Aug 7 07:48:20 PDT 2010


simendsjo:
> When I do the same with a static array, I get 0. But this is just 
> actually garbage, right? It might contain other data, and not always 0?

Generally it contains "garbage".
In string literals there is one more item that's empty (zero). I don't know if normal fixed-sized arrays too have the extra leading zero item (maybe yes), but relying on it is surely bad programming practice.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list