0 < negative loop condition bug or misunderstanding on my part

Jonathan M Davis jmdavisProg at gmx.com
Wed Mar 7 19:46:04 PST 2012


On Thursday, March 08, 2012 16:15:08 James Miller wrote:
> Its the semantics in C/C++ and D explicitly tries to have the same
> semantics as them. From what I remember its to aid people moving from
> those language to D.

More like it's to avoid code silently breaking when it's ported. In general, 
C/C++ code is either valid D code with identical semantics, or it won't 
compile as D code. There are a _few_ exceptions (e.g. static arrays are passed 
by value), but they're far and few between. Porting C/C++ code to D would be 
much nastier if the C/C++ compiled as D code but had different semantics.

In addition to that, I believe that Walter's take on it is to generally leave 
stuff as it is in C/C++ unless there's a good reason to change it. Obviously, 
there's a lot which was worth changing, and there's tons of stuff in D which is 
different form C/C++. But there's a lot of little stuff that wasn't messed with, 
because there just wasn't a good reason to.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list