htod - convert C .h files to D import files
Rémy Mouëza
Rémy_member at pathlink.com
Sat May 27 09:03:47 PDT 2006
>>
>>But if that happened, things lke concatenation would cause problems.
>>
>>#define FOO "foo"
>>#define BAR "bar"
>> |
>> |
>> V
>>const char[] FOO = "foo\0"; //explicitly null terminate
>>const char[] BAR = "bar\0"; //explicitly null terminate
>>
>>. . .
>>
>> char[] x = FOO ~ BAR; // Now it has an embedded \0 !
I thought that D managed the "\0" characters ( that was why we hadn't to put any
in our char [] variables ). Therefore I made the following test :
// constchar.d
import std.stdio ;
const char [] foo = "foo\0" ;
typeof ( foo ) bar = "bar\0" ;
void main ()
{
char [] test = foo ~ bar ;
writefln ( test );
}
ray at Moonraker:~/dee/tmp$ ./constchar
foobar
Seems that there is no problem. I may have not understand something.
More information about the Digitalmars-d-announce
mailing list