DMD 1.005 release

Walter Bright newshound at digitalmars.com
Tue Feb 6 21:13:02 PST 2007


janderson wrote:
> Walter Bright wrote:
>> Some things that you can do with import that you cannot do with #include:
>>
>> 1) You can have tech writers write "help text" files, which can then 
>> be imported by the programmers as string literals. This means the tech 
>> writers do not have to be concerned in the slightest with string syntax.
> 
> They could just add quotes around them in C.

Not exactly. You cannot have multiline string literals in C. You'd have 
to use \n\ line splicing, and escape any " and \ embedded in the text:

"Your text\n\
would have to\n\
look like this\n\
and be careful to\n\
escape any \"s in\n\
the text, as well as\n\
any \\s."

Furthermore, string literals are limited to 4095 characters (if one 
cares about portability). C99 5.2.4.1

These restrictions are annoying enough that I've preferred using runtime 
reading and loading of the message file instead.



More information about the Digitalmars-d-announce mailing list