[OT] Walter about compilers
Era Scarecrow
rtcvb32 at yahoo.com
Tue Jan 22 06:44:22 PST 2013
On Tuesday, 22 January 2013 at 13:54:08 UTC, eles wrote:
> The text opens with...:
>
> "We like it when people always want more! Otherwise, we'd be
> out of the upgrade business. Sometimes, people ask me what I
> will do when the compiler is done. Done? No software program
> that is selling is ever done!
> -- Walter Bright, C++ compiler architect"
>
> So... the question is: does that quote also applies for dmd? :)
It's been quoted that for every 10 lines of code there's a bug.
There are programs with tens of thousands of lines of code, so
finding every bug is probably impossible for large programs
(above 1000 lines). But that doesn't mean they can't run very
very well. A number of the bugs for unchecked work is addition
for example, perhaps simplest of operations; Are you going to
check after every little + that you didn't have an overflow?
Without a lot of extra work are you going to include checks that
ensure they can't break?
C example:
//code looks okay
void* getMemory(int a, int b) {
return malloc(a + b);
}
//becomes negative due to overflow. it can happen
//probably returns NULL. I don't know..
void* ptr = getMemory(0x7fffffff, 0x7fffffff);
//overflow free version?
void* getMemory(unsigned int a, unsigned int b) {
//max name may be wrong, but you get the idea.
//don't remember, need third cast?
assert(((long long) a) + ((long long) b) <= UNSIGNED_INT_MAX);
return malloc(a + b);
}
//should assert now
void* ptr = getMemory(UNSIGNED_INT_MAX, UNSIGNED_INT_MAX);
Since part of the process is not only fixing bugs and improving
the compiler, but there's also new features that may be requested
that you find necessary yet never needed before you thought about
it.
Consider: A recent project of mine that I hadn't updated in over
a year and a half seemed to have a bug with how it handled a
certain feature and was just brought up, needed to add about 10
lines of code to handle it; Then I found a bug within those 10
lines (after it was working).
With that in mind, it's likely no program will be 'done', but if
they do the job well enough then it's probably good enough. So to
answer it, the answer is probably yes it applies to dmd.
More information about the Digitalmars-d
mailing list