Static Array with negative index results in a strange error-message
Steven Schveighoffer
schveiguy at yahoo.com
Mon Apr 23 13:48:07 UTC 2018
On 4/23/18 9:32 AM, Dgame wrote:
> char[-1] c;
>
> results in
>
> Error: char[18446744073709551615LU] size 1 * 18446744073709551615
> exceeds 0x7fffffff size limit for static array
>
> Should we fix that? A negative index should be IMO detected sooner/with
> a cleaner error message.
Hm.. at least it's detected. I actually don't think the message is
wrong: -1 is a valid size_t literal, and results in that number.
if you did:
enum size_t x = -1;
char[x] c;
You would get the same result, and I don't know how we would fix that.
-Steve
More information about the Digitalmars-d-learn
mailing list