Array length : size_t

Dicebot public at dicebot.lv
Wed Sep 18 15:52:55 PDT 2013


On Wednesday, 18 September 2013 at 22:20:45 UTC, H. S. Teoh wrote:
> If the C function only accepts int, then just use 
> to!int(array.size). If
> the size overflows int, to() will throw an exception which you 
> can
> handle. This is probably the best you can do anyway, since if 
> the C
> function doesn't take anything bigger than int, then there's no 
> way you
> can pass the real size to it.

Ah, `to!()` does check valid ranges before conversion? Good to 
know, thanks.


More information about the Digitalmars-d-learn mailing list