October 26, 2014 [Issue 13658] New: Array length type is not size_t | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13658 Issue ID: 13658 Summary: Array length type is not size_t Product: D Version: D2 Hardware: All OS: Windows Status: NEW Severity: normal Priority: P1 Component: DMD Assignee: nobody@puremagic.com Reporter: markisaa@umich.edu According to the language reference at: http://dlang.org/arrays, the .length property of an array is meant to return a value with type size_t. That is not the case on Windows with dmd 2.066. This issue is more widespread than just the .length property; I discovered this by trying to index an array with a ulong (same type as size_t) and found dmd yelling about implicit conversions to uint. The problematic code was of the form: myArray[thingThatReturnsULong() - 1 - 1]; For reference, the precise line of code that breaks: https://github.com/facebook/flint/blob/master/Checks.d#L3016 I confirmed the types of size_t, myArray.length, and a few other things using pragma(msg, typeof(thing)); For what it's worth, if you pointed me at roughly the write part of the code that needed fixing, I would gladly make the change; I wasn't able to find the relevant code in druntime and the dmd repo is a mystery to me. -- |
Copyright © 1999-2021 by the D Language Foundation