Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

empty string in D programing language

Tags:

arrays

string

d

What is empty string in D programing language?

String is array of characters ( http://dlang.org/arrays.html#strings )
Probably: alias immutable(char)[] string

Based on that empty string should be an empty array. But then, what kind of thing the empty array is?

Any ideas?

like image 336
dnsmkl Avatar asked Dec 07 '22 15:12

dnsmkl


1 Answers

any (non-static) array is essentially a struct with a pointer to the start of the memory block the array is contained in and a length

an empty array just has length==0

like image 132
ratchet freak Avatar answered Dec 21 '22 07:12

ratchet freak