The name string is aliased to immutable(char)[]
Why was immutable chosen? Why not mutable. Or why not just make
another alias called
strung where it is aliased to mutable(char)[]
Also, since strings are arrays and arrays are structs with a
length and ptr
field, I ran the following code for
On Sat, 13 Sep 2014 17:09:56 +
WhatMeWorry via Digitalmars-d-learn
wrote:
> I guess I was expecting them to be equivalent. I can understand
> why both lengths are zero. But what is emptyStr.ptr doing with
> the 42F080 value? I presume this is a address? If so, what does
> this address c
On Saturday, 13 September 2014 at 17:31:18 UTC, ketmar via
Digitalmars-d-learn wrote:
On Sat, 13 Sep 2014 17:09:56 +
WhatMeWorry via Digitalmars-d-learn
wrote:
I guess I was expecting them to be equivalent. I can
understand why both lengths are zero. But what is
emptyStr.ptr doing wit
On Sat, 13 Sep 2014 22:41:38 +
AsmMan via Digitalmars-d-learn
wrote:
> D string are actullay C-strings?
in no way. only string *LITERALS* are zero-terminated.
signature.asc
Description: PGP signature
On Saturday, 13 September 2014 at 22:41:39 UTC, AsmMan wrote:
D string are actullay C-strings?
No. But string *literals* are guaranteed to be 0-terminated for
easier interoperability with C code.
David
On Saturday, 13 September 2014 at 23:22:40 UTC, ketmar via
Digitalmars-d-learn wrote:
On Sat, 13 Sep 2014 22:41:38 +
AsmMan via Digitalmars-d-learn
wrote:
D string are actullay C-strings?
in no way. only string *LITERALS* are zero-terminated.
Ok. So I wrote the following:
char c = *(
On Sun, 14 Sep 2014 00:34:54 +
WhatMeWorry via Digitalmars-d-learn
wrote:
> So is one form (Empty strings versus null strings) considered
> better than the other? Or does it depend on the context?
one is better than another in the sense that blue is better than green
(or vice versa). ;-)
d
On 09/13/2014 05:34 PM, WhatMeWorry wrote:
aren't all strings literals?
Literals are values that are typed as is in source code:
http://en.wikipedia.org/wiki/Literal_%28computer_programming%29
Ali
On Sunday, 14 September 2014 at 00:34:56 UTC, WhatMeWorry wrote:
So is one form (Empty strings versus null strings) considered
better than the other? Or does it depend on the context?
For all practical purposes they should be equivalent in D code. I
suppose the distinction exists because some
On Sunday, 14 September 2014 at 09:07:26 UTC, Kagamin wrote:
On Sunday, 14 September 2014 at 00:34:56 UTC, WhatMeWorry wrote:
So is one form (Empty strings versus null strings) considered
better than the other? Or does it depend on the context?
For all practical purposes they should be equiva
On Sun, 14 Sep 2014 09:07:25 +
Kagamin via Digitalmars-d-learn
wrote:
> Also for some reason boolean value of a string is derived from
> ptr instead of length... meh.
for the reason that all reference objects either "null" or "non-null".
empty string is non-null, so... it's C leftover actual
On 9/14/2014 2:09 AM, WhatMeWorry wrote:
The name string is aliased to immutable(char)[]
Why was immutable chosen? Why not mutable. Or why not just make another
alias called
strung where it is aliased to mutable(char)[]
If you want a mutable array of characters, just use char[].
---
This
On Saturday, 13 September 2014 at 23:21:09 UTC, David Nadlinger
wrote:
On Saturday, 13 September 2014 at 22:41:39 UTC, AsmMan wrote:
D string are actullay C-strings?
No. But string *literals* are guaranteed to be 0-terminated for
easier interoperability with C code.
David
ah makes sense.
On Sunday, 14 September 2014 at 13:48:01 UTC, ketmar via
Digitalmars-d-learn wrote:
for the reason that all reference objects either "null" or
"non-null".
empty string is non-null, so... it's C leftover actually. there
are
alot such leftovers in D.
For pointers it's logical, but it doesn't wo
14 matches
Mail list logo