htod - convert C .h files to D import files
BCS
BCS_member at pathlink.com
Wed May 24 18:37:43 PDT 2006
In article <e52ivj$3am$1 at digitaldaemon.com>, Tom S says...
>
>BCS wrote:
>> Walter Bright wrote:
>>> I'm not sure how useful this will be.
>>>
>>> Here it is: http://www.digitalmars.com/d/htod.html
>>
>>
>> One case that it doesn't handle but would seem to be simple is:
>>
>> #define FOO "bar"
>> |
>> v
>> const char[] FOO = "bar\0"; //explicitly null terminate
>
>Why would you need it to be explicitly null terminated ? D string
>literals have a zero anyway just after their normal data (it's not
>reflected by the 'length' property, but it's there).
>
#1 because that behavior it not in standard (AFAIK)
#2 copying
<code file=a.h>
#define FOO "start"
#define FOO "stop"
int func(char* string);
<\code>
<code file=b.d>
import a;
..
char[] command = FOO;
..
char[] use = command.dup; // don't known why, but someone going to do it
..
func(use.prt); // now what??
..
<\code>
More information about the Digitalmars-d-announce
mailing list