A reason to choose D over Go

Jonathan M Davis via Digitalmars-d digitalmars-d at puremagic.com
Sun Mar 22 23:41:32 PDT 2015

On Sunday, March 22, 2015 02:32:36 deadalnix via Digitalmars-d wrote:
> On Sunday, 22 March 2015 at 01:44:32 UTC, weaselcat wrote:
> > On Sunday, 22 March 2015 at 01:24:10 UTC, Martin Nowak wrote:
> >> On Saturday, 21 March 2015 at 23:49:26 UTC, Atila Neves wrote:
> >>> I actually think that there are two large categories of
> >>> programmers: those like writing the same loops over and over
> >>> again and those who use algorithms.
> >>
> >> I agree, at some point I learned that there is a huge cultural
> >> distinction between C and C++ programmers.
> >
> > yes, the other main distinction are the people who correctly
> > put the * next to the type because it's part of the type, or
> > the wrong people who put it next to the variable name because
> > they're heathens
> What is the type of b here ?
> int* a, b;

Which is one reason never to declare multiple variables on the same line in
C/C++. I never understood why C/C++ made it so that the * went with the
variable rather than being treated like part of the type, since in reality,
the * is part of the type. I'm definitely glad that D fixed that and made it
so that the a and b in your example are both pointers.

But much as I hate it when folks put the * next to the variable name in
C/C++ instead of putting it with the rest of the type, your example shows
exactly why many people put it with the variable name.

- Jonathan M Davis

More information about the Digitalmars-d mailing list