May 30, 2014
On Wednesday, 28 May 2014 at 07:21:56 UTC, dennis luehring wrote:
> woudl be nice to have some sort of example by example comparison
> or as an extension to the page http://dlang.org/cpptod.html

I've got two posts complete[1]. Since C++ and D are exactly the same for the majority of the code I'm only showing D and talk of C++'s choice. While the rules governing D's behavior are fairly simple I feel that I've expanded on the content enough to provide useful information beyond fixing C++'s problems.

1. http://he-the-great.livejournal.com/52333.html
May 30, 2014
On Tue, 27 May 2014 22:40:00 +0100, Walter Bright <newshound2@digitalmars.com> wrote:

> On 5/27/2014 2:22 PM, w0rp wrote:
>> I'm actually a native speaker of 25 years and I didn't get it at first. Natural
>> language communicates ideas approximately.
>
> What bugs me is when people say:
>
>     I could care less.

I've always assumed some sort of sentence finishing laziness on their part.  As in, "I could care less, but it would be pretty hard to do so" or something like that.

R
May 30, 2014
On 5/29/14, 9:21 PM, Jesse Phillips wrote:
> On Wednesday, 28 May 2014 at 07:21:56 UTC, dennis luehring wrote:
>> woudl be nice to have some sort of example by example comparison
>> or as an extension to the page http://dlang.org/cpptod.html
>
> I've got two posts complete[1]. Since C++ and D are exactly the same for
> the majority of the code I'm only showing D and talk of C++'s choice.
> While the rules governing D's behavior are fairly simple I feel that
> I've expanded on the content enough to provide useful information beyond
> fixing C++'s problems.
>
> 1. http://he-the-great.livejournal.com/52333.html

Nice! I'll post it tomorrow on reddit and friends. You have an unmatched brace after "assert(a2[].all!(x => x == 0));".

Andrei
May 30, 2014
On 5/30/14, 3:53 AM, Andrei Alexandrescu wrote:
> On 5/29/14, 9:21 PM, Jesse Phillips wrote:
>> On Wednesday, 28 May 2014 at 07:21:56 UTC, dennis luehring wrote:
>>> woudl be nice to have some sort of example by example comparison
>>> or as an extension to the page http://dlang.org/cpptod.html
>>
>> I've got two posts complete[1]. Since C++ and D are exactly the same for
>> the majority of the code I'm only showing D and talk of C++'s choice.
>> While the rules governing D's behavior are fairly simple I feel that
>> I've expanded on the content enough to provide useful information beyond
>> fixing C++'s problems.
>>
>> 1. http://he-the-great.livejournal.com/52333.html
>
> Nice! I'll post it tomorrow on reddit and friends. You have an unmatched
> brace after "assert(a2[].all!(x => x == 0));".
>
> Andrei

Actually a bunch of unmatched braces (formatter eats the closing one?) and at least one ";;" instead of ";". -- Andrei
May 30, 2014
On Friday, 30 May 2014 at 04:21:18 UTC, Jesse Phillips wrote:
>
> 1. http://he-the-great.livejournal.com/52333.html

Note that in the following code:
    import core.memory : GC;
    int* pxprime = cast(int*)GC.malloc(int.sizeof);
    version(none) assert(pxprime); // possibly zero

GC.malloc currently doesn't initialize the memory if NO_SCAN is specified as attribute.
Also, I don't understand why half of your asserts have version(none) (it's distracting.)
Also note that you're not dereferencing pxprime, I'm not sure if its intentional.
May 30, 2014
On Friday, 30 May 2014 at 10:56:30 UTC, Andrei Alexandrescu wrote:
>> Nice! I'll post it tomorrow on reddit and friends. You have an unmatched
>> brace after "assert(a2[].all!(x => x == 0));".
>>
>> Andrei
>
> Actually a bunch of unmatched braces (formatter eats the closing one?) and at least one ";;" instead of ";". -- Andrei

It is not unmatched, the whole article is one big program (with the exception of the conclusion), the final brace is at the end:

    static int[100] a3;
    assert(a3[].all!(x => x == 0));
}

Though the ;; is just an accident.
May 30, 2014
On Friday, 30 May 2014 at 11:31:18 UTC, safety0ff wrote:
> On Friday, 30 May 2014 at 04:21:18 UTC, Jesse Phillips wrote:
>>
>> 1. http://he-the-great.livejournal.com/52333.html
>
> Note that in the following code:
>     import core.memory : GC;
>     int* pxprime = cast(int*)GC.malloc(int.sizeof);
>     version(none) assert(pxprime); // possibly zero
>
> GC.malloc currently doesn't initialize the memory if NO_SCAN is specified as attribute.

I expect malloc to not initialize ever, that was the point. Initialization can be done with calloc.

> Also, I don't understand why half of your asserts have version(none) (it's distracting.)

I can't guarantee the assert to pass, as the comment mentions it is possibly zero, which would cause failure.

> Also note that you're not dereferencing pxprime, I'm not sure if its intentional.

Thanks,  was intending to dereference.

Thank you for feedback.
May 30, 2014
On 5/29/14, 9:21 PM, Jesse Phillips wrote:
> On Wednesday, 28 May 2014 at 07:21:56 UTC, dennis luehring wrote:
>> woudl be nice to have some sort of example by example comparison
>> or as an extension to the page http://dlang.org/cpptod.html
>
> I've got two posts complete[1]. Since C++ and D are exactly the same for
> the majority of the code I'm only showing D and talk of C++'s choice.
> While the rules governing D's behavior are fairly simple I feel that
> I've expanded on the content enough to provide useful information beyond
> fixing C++'s problems.
>
> 1. http://he-the-great.livejournal.com/52333.html

http://www.reddit.com/r/programming/comments/26vy2i/comparing_scott_meyers_talk_examples_in_c_and_d/

Andrei
May 31, 2014
On Friday, 30 May 2014 at 04:21:18 UTC, Jesse Phillips wrote:
> I've got two posts complete[1]. Since C++ and D are exactly the same for the majority of the code I'm only showing D and talk of C++'s choice. While the rules governing D's behavior are fairly simple I feel that I've expanded on the content enough to provide useful information beyond fixing C++'s problems.
>
> 1. http://he-the-great.livejournal.com/52333.html

What do you mean "D does not provide a decltype"?

typeof(cx) my_cx2 = cx;
May 31, 2014
On Saturday, 31 May 2014 at 07:32:22 UTC, Kagamin wrote:
> What do you mean "D does not provide a decltype"?
>
> typeof(cx) my_cx2 = cx;

I'll blame this on my poor knowledge of C++, at this time typeof in C++ does not appear to compile, in the way I'm trying to use it. I thought using typeof in C++ would result in the same answer as the deduction auto provides.

From that point of view, there is no need for decltype, because typeof already gives you the actual type in D (which will be the same as the type at declaration).