dmd 1.046 and 2.031 releases
bearophile
bearophileHUGS at lycos.com
Mon Jul 6 05:26:24 PDT 2009
I have just started trying the latest D1 compiler; if I try to compile my dlibs DMD stops with this error:
Assertion failure: '0' on line 136 in file 'statement.c'
I'll try to locate the trouble better.
--------------------
I can see a very large amount of bug fixes.
>Use of with symbols that shadow local symbols is no longer allowed<
>std.conv: added Shin Fujishiro's code for printing and parsing enumerated values.<
Good.
Walter:
>The deps thing comes from the LDC group. They've been relying on it as-is, so they'd need to agree on any changes.<
Some of the ideas of Derek Parnell regarding 'deps' seems a significant improvement. (LDC developers are quite flexible, and they usually agree to improve things when they can.)
>Bugzilla 2900: Array appending slowed drastically since integration of druntime<
How is it implemented the "solution" to this?
>Implicit integral conversions that could result in loss of significant bits are no longer allowed.<
That doesn't seem to solve a bug-prone situation like:
import std.stdio: writeln;
void main() {
int[] a = [1, 2];
a ~= 3;
writeln("a.length=", a.length);
int n = 5;
writeln("n=", n, " (a.length < n)=", a.length < n);
n = -5;
writeln("n=", n, " (a.length < n)=", a.length < n);
}
In the meantime, until a better solution is found, I suggest to change all "length"s to being of type ptrdiff_t, that is safer.
--------------------
Possible worsenings:
Walter:
>The final switch deals with a problem where you add an enum member in one file and then have to find and update every switch statement that uses that enum. There's no straightforward way to find them to ensure the case gets added to each switch. It's solving a similar problem that symbolic constants do. The fall-through thing, though, is purely local and so much less of an
issue.<
Having two kinds of switch in a language is not a nice thing, C++ teaches us that duplication in a language is bad.
And big and really well debugged programs in the past have failed for the fall-through-related bug, time ago I have shown a fasmous so there's evidence it's indeed an issue.
You may take a look at the 50 thousand answers given by Google here:
http://www.google.com/search?q=switch+%22fall-through%22+bug
Also, I have already shown this in the past:
http://www.soft.com/AppNotes/attcrash.html
So:
- If you go to accept the hassle to have two kind of switch statements, then it may be better to make one of them not perform fall-through by default.
- To avoid switch-related bugs the safe one has to be the default. A possible solution is then to have "switch" that acts safely and a "cswitch" that's there for C compatibility :-) Scala, Java and C# show that other solutions are possible.
>D does introduce another operator, the :..case operator <g>.<
Unfortunately the brain of all people will see just ".." as the operator there, and it has a different semantics there, it's a special case. I am not going to like this.
>std.string: deprecated std.string.find and std.string.find, replaced with std.string.indexOf; deprecated std.string.rfind and std.string.irfind, replaced with std.string.lastIndexOf; added flag CaseSensitive for indexOf and lastIndexOf; removed startsWith and endsWith because std.algorithm defines them; defined std.string.byDchar.<
Replacing the simple to read, and easy to understand names "find" and "rfind" with "indexOf" and "lastIndexOf" that are longer and also have upper case letters in the middle looks doesn't look like an improvement.
---------------------------
Derek Parnell:
> If this is ok can I submit a patch?
Please, do it :-)
>And in that vein, a hash (eg CRC32, MD5, SHA256) of the file's used by DMD would be nice to see in the 'deps' file. Would help build tools detect which files have been modified.<
A 64 bit hash value may be enough.
But before the hash it may also be useful a timestamp, it can be a "fast path" to see if the module is changed and avoid computing the 64 bit hash value (that requires some time if done on megabytes of source code). If the time is different then the module is considered different. If the timestamp is the same then the hash is computed.
Bye,
bearophile
More information about the Digitalmars-d-announce
mailing list