about std.string.representation

bioinfornatics bioinfornatics at fedoraproject.org
Wed Nov 13 16:32:28 PST 2013


Hi,
I try to understand which type char, dchar, wchar will give 
ubyte,ushort,uint…

for this i try :

------------ CODE ---------------------
import std.string;

void main(){
	string  t  = "test";
	char[]  c  = "test".dup;
	dchar[] dc = "test"d.dup;
	wchar[] wc = "test"w.dup;
	writeln( typeid( t ),  ' ',  t.sizeof,  ' ', t.representation()  
);
	writeln( typeid( c ),  ' ',  c.sizeof,  ' ', c.representation()  
  );
	writeln( typeid( dc ), ' ', dc.sizeof, ' ', dc.representation() 
);
	writeln( typeid( wc ), ' ', wc.sizeof, ' ', wc.representation() 
);
}
------------ RESULT ---------------------
immutable(char)[]16 [116, 101, 115, 116]
char[] 16 [116, 101, 115, 116]
dchar[] 16 [116, 101, 115, 116]
wchar[] 16 [116, 101, 115, 116]
------------------------------------------

each time it seem ushort is used someone coul explaen please?


More information about the Digitalmars-d-learn mailing list