A summary of D's design principles
Denis Koroskin
2korden at gmail.com
Wed Sep 15 13:41:37 PDT 2010
On Wed, 15 Sep 2010 23:36:48 +0400, Walter Bright
<newshound2 at digitalmars.com> wrote:
> Simen kjaeraas wrote:
>> bearophile <bearophileHUGS at lycos.com> wrote:
>>
>>> One of yours fixed:
>>> - If it works in C, it works (almost) the same or not at all in D.
>> Mind giving examples to this one? I thought this was a big no-no.
>
> I'm curious what bearophile is referring to, too. We've worked hard to
> ensure that C code either produces the same result (as defined behavior
> in C would) or fails to compile.
>
> And I'd add to that that the performance of C code written in D should
> match or exceed performance of the same code compiled with a C compiler.
>
> I'd put this under the heading of "D As A Better C".
Here is one of the examples (valid C/C++ and D program):
void modify(int foo[4])
{
foo[0] = 42;
}
int main()
{
int foo[4];
modify(foo);
return foo[0]; // returns 0 in D, 42 in C/C++
}
More information about the Digitalmars-d
mailing list