example of pointer usefulness in D
monarch_dodra via Digitalmars-d
digitalmars-d at puremagic.com
Tue Oct 21 05:47:28 PDT 2014
On Tuesday, 21 October 2014 at 12:22:54 UTC, edn wrote:
> Could someone provide me with examples showing the usefulness
> of pointers in the D language? They don't seem to be used as
> much as in C and C++.
The only difference between C/C++ and D is that C uses pointers
for both "pointer to object" and "pointer to array", whereas D
has a "slice" object.
C++ introduced "pass-by-ref" (also exists in D), which has tended
to reduce the (visible) use.
Furthermore, the more modern the language, the more the "raw"
pointers tend to be encapsulated in structures that manage them
for you.
So while you don't "see" them quite as much, they are still
there, and fill exactly the same role.
More information about the Digitalmars-d
mailing list