Finding out about D - 101

BCS none at anon.com
Mon May 11 09:58:01 PDT 2009


Hello Steve,

> This tells me that a string in D is a sequence of characters (whatever
> that might mean) in memory, prefixed by a size_t length. Of  course,
> that's not to say there is no more to it, but the values for 'xtra'
> don't give us much clue. If there was some other member of struct S,
> I'd kind of expect to see bit flags there indicating whether the array
> of char was invariant, const, or fair game.

T[] is a length/pointer pair. If the data ends up being right after that 
bit, then it's just a coincidence.

> 
> So I'm left with the question as to how does 'invariant' have teeth?
> 

const and invariant are both implemented completely at compile time so they 
don't show up the final code at all.




More information about the Digitalmars-d-learn mailing list