Some compile time help..

simendsjo simendsjo at gmail.com
Sun Mar 4 09:47:45 PST 2012


On Sun, 04 Mar 2012 18:14:28 +0100, Andrej Mitrovic  
<andrej.mitrovich at gmail.com> wrote:

> On 3/4/12, Daniel Murphy <yebblies at nospamgmail.com> wrote:
>> void f(Args...)(Args args) {
>>   foreach(i, T; Args)
>>   {
>>     static if (isSomeString!T) args[i] = toUTFz(args[i]);
>>   }
>>   needs_wchar_t(args);
>> }
>
> toUTFz returns a pointer, the isSomeString checks if a type is a
> string. IOW that will try to assign a pointer to a string.
>
> But I don't understand the OPs requirements, what type does
> 'needs_wchar_t' take? A wchar*? A wchar**? Variadic arguments? Or
> something else?

A variadic C function:
extern(C) void someFormatting(wchar_t* format, ...)

But I get some unexpected results.. wchar_t is defined as dchar on linux  
and wchar on windows, but it seems to only work with utf8..
Sending in wchar or dchar prints only the first characted as I guess it  
just see \0 at the next.
I'll have to look at the original source in case it has some strange  
typedefs.


More information about the Digitalmars-d-learn mailing list