On Wed, 15 Sep 2010 23:36:48 +0400, Walter Bright
<newshou...@digitalmars.com> wrote:
Simen kjaeraas wrote:
bearophile <bearophileh...@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++
}