sc.ini and delegates
Nick Sabalausky
SeeWebsiteToContactMe at semitwist.com
Mon Feb 24 16:22:29 PST 2014
On 2/24/2014 3:54 PM, Eugene Yang wrote:
> Hello all,
>
> If I want to set custom imports and library search paths for a specific
> project, how do I specify those paths in the sc.ini file? Setting the
> DFLAGS environment variable seems to override the default settings; is
> there a way I can append to the default DFLAGS variable?
>
sc.ini isn't really the right place for custom or project-specific
imports. Just use the compiler's -I... flag, and wrap it up in a
one-liner shell script if you need to.
> I get an error saying that toInverse is not callable with the argument
> type dchar. Why is line, which should be immutable(char)[] being casted
> as a dchar array?
>
Because of Unicode. Despite the outdated name, a "char" is not really a
character, it's a UTF-8 code unit, not a code point, and not a grapheme
(ie a full character).
See this if you're not already up-to-speed on code units vs code points:
http://www.joelonsoftware.com/articles/Unicode.html
Working with code units instead of code points is usually the wrong
thing to do and leads to lots of bugs with non-english text. So by
default, D iterates strings by 32-bit code point, not by code unit
(behind the scenes, it calls decode()).
Since code points and code units are ONLY equivalent in UTF-32, D always
uses the 32-bit dchar to represent code points. So no matter whether
you're iterating a UTF-8 string, a UTF-16 wstring or UTF-32 dstring, D's
default is to always iterate by decoding one code point (as a dchar) at
a time.
In the rare cases you want to iterate by individual code units (never do
this unless you have a strong grasp of Unicode and really know what
you're doing), you can do this:
string foo = ...;
foreach(char ch; foo) {...}
More information about the Digitalmars-d
mailing list