when is a GDC/D2/Phobos bug a GDC bug?
Iain Buclaw
ibuclaw at ubuntu.com
Tue Nov 23 16:56:49 PST 2010
== Quote from dsimcha (dsimcha at yahoo.com)'s article
> == Quote from Graham Fawcett (fawcett at uwindsor.ca)'s article
> > Hi folks,
> > I've played with the new GDC version today. Overall it seems solid, but
> > I've encountered some issues that are probably Phobos-related. Since
> > this is my first 64-bit D compiler, I wonder whether some parts of
> > Phobos might not yet be 64-bit ready.
> FWIW, SVN Phobos passes 64-bit semantic analysis even with unittests
> instantitating templates on DMD. DMD is mostly 64-bit capable, but a lot of
> nitty-gritty issues remain before it can be used for anything more than semantic
> analysis. Phobos 2.050 hadn't been fully fixed for 64 support. Iaian has
> apparently been patching it to get it to compile, but a more thorough job was done
> on the main SVN trunk recently.
The only 64bit-related changes I've made are quite slim now. Though yes I've only
been doing "enough" to get it compiling. Around the 2.040 merge, I made the
decision to drop the entire library that was currently maintained in the GDC2 tree
in favour of just using the upstream version - with minimal GDC-specific changes
added, of course (frequent hefty changes in Phobos2 and headaches from merges that
were more complicated than they needed to be brought this about).
In a way, now I have less on my plate to worry about. And it leaves most of the
work to the job of the Phobos Devs to get on with what they do best.
--- src/phobos/crc32.d 2010-11-19 22:39:03.387906002 +0000
+++ d/phobos2/crc32.d 2010-11-20 13:06:33.711039410 +0000
@@ -73,7 +73,7 @@
uint strcrc32(char[] s)
{
uint crc = init_crc32();
- for (int i = 0; i < s.length; i++)
+ for (size_t i = 0; i < s.length; i++)
crc = update_crc32(s[i], crc);
return crc;
}
--- src/phobos/std/algorithm.d 2010-11-19 22:39:03.059906002 +0000
+++ d/phobos2/std/algorithm.d 2010-11-22 13:33:42.718249002 +0000
@@ -2682,7 +2682,7 @@
haystack.popFront), $(D haystack.startsWith!pred(needle)). If no such
number could be found, return $(D -1).
*/
-int indexOf(alias pred = "a == b", R1, R2)(R1 haystack, R2 needle)
+sizediff_t indexOf(alias pred = "a == b", R1, R2)(R1 haystack, R2 needle)
if (is(typeof(startsWith!pred(haystack, needle))))
{
static if (isNarrowString!R1)
--- src/phobos/std/format.d 2010-11-19 22:39:02.715906002 +0000
+++ d/phobos2/std/format.d 2010-11-23 00:19:07.651608384 +0000
@@ -949,12 +962,12 @@
// write left pad; write sign; write 0x or 0X; write digits;
// write right pad
// Writing left pad
- int spacesToPrint =
+ sizediff_t spacesToPrint =
f.width // start with the minimum width
- digits.length // take away digits to print
- (forcedPrefix != 0) // take away the sign if any
- (base == 16 && f.flHash && arg ? 2 : 0); // 0x or 0X
- const int delta = f.precision - digits.length;
+ const sizediff_t delta = f.precision - digits.length;
if (delta > 0) spacesToPrint -= delta;
//writeln(spacesToPrint);
if (spacesToPrint > 0) // need to do some padding
@@ -980,7 +993,7 @@
// write the digits
if (arg || f.precision)
{
- int zerosToPrint = f.precision - digits.length;
+ sizediff_t zerosToPrint = f.precision - digits.length;
foreach (i ; 0 .. zerosToPrint) put(w, '0');
put(w, digits);
}
More information about the Digitalmars-d
mailing list