Re: AA behaves differently in CTFE?

2015-11-24 Thread Bastiaan Veelo via Digitalmars-d-learn
On Tuesday, 24 November 2015 at 07:54:24 UTC, Bastiaan Veelo wrote: This results TRUE at compile time, but FALSE at run time. Sorry, that should be the reverse: TRUE at run time, FALSE at compile time. Compile time exhibits the unexpected behaviour.

Something about Chinese Disorder Code

2015-11-24 Thread magicdmer via Digitalmars-d-learn
I display chinese string like: auto str = "你好,世界" writeln(str) and The display is garbled。 some windows api like MessageBoxA ,if string is chinese, it displays disorder code too i think i must use WideCharToMultiByte to convert it , is there any other answer to solve this question simplely

Re: Something about Chinese Disorder Code

2015-11-24 Thread Rikki Cattermole via Digitalmars-d-learn
On 24/11/15 10:48 PM, magicdmer wrote: I display chinese string like: auto str = "你好,世界" writeln(str) and The display is garbled。 some windows api like MessageBoxA ,if string is chinese, it displays disorder code too i think i must use WideCharToMultiByte to convert it , is there any other an

Re: Something about Chinese Disorder Code

2015-11-24 Thread Andrea Fontana via Digitalmars-d-learn
On Tuesday, 24 November 2015 at 09:48:45 UTC, magicdmer wrote: I display chinese string like: auto str = "你好,世界" writeln(str) and The display is garbled。 some windows api like MessageBoxA ,if string is chinese, it displays disorder code too i think i must use WideCharToMultiByte to convert

Re: Something about Chinese Disorder Code

2015-11-24 Thread Meta via Digitalmars-d-learn
On Tuesday, 24 November 2015 at 09:52:21 UTC, Rikki Cattermole wrote: On 24/11/15 10:48 PM, magicdmer wrote: I display chinese string like: auto str = "你好,世界" writeln(str) and The display is garbled。 some windows api like MessageBoxA ,if string is chinese, it displays disorder code too i t

Re: AA behaves differently in CTFE?

2015-11-24 Thread Steven Schveighoffer via Digitalmars-d-learn
On 11/24/15 2:59 AM, Bastiaan Veelo wrote: On Tuesday, 24 November 2015 at 07:54:24 UTC, Bastiaan Veelo wrote: This results TRUE at compile time, but FALSE at run time. Sorry, that should be the reverse: TRUE at run time, FALSE at compile time. Compile time exhibits the unexpected behaviour.

Re: Something about Chinese Disorder Code

2015-11-24 Thread BLM768 via Digitalmars-d-learn
On Tuesday, 24 November 2015 at 09:48:45 UTC, magicdmer wrote: I display chinese string like: auto str = "你好,世界" writeln(str) and The display is garbled。 some windows api like MessageBoxA ,if string is chinese, it displays disorder code too i think i must use WideCharToMultiByte to convert

How to use D parallel functions/library

2015-11-24 Thread Bishop120 via Digitalmars-d-learn
Hey everyone. A new D learner here. So far I love D and how much better its working than C++. One thing I like doing is parallel functions so with C++ using OMP. Right now Im trying to figure out how to do Conways Game of Life in D in parallel. Serially D is much faster than C++ so I feel

DUB, Platform specifications and dependencies

2015-11-24 Thread Zardoz via Digitalmars-d-learn
Actually I'm trying to setup dub to not grab a dependency on Windows ( https://github.com/Zardoz89/DEDCPU-16/blob/master/dub.sdl ) : name "dedcpu" authors "Luis Panadero Guardeño" targetType "none" license "BSD 3-clause" description "DCPU-16 tools" subPackage { name "lem1802" description "

Re: AA behaves differently in CTFE?

2015-11-24 Thread Bastiaan Veelo via Digitalmars-d-learn
On Tuesday, 24 November 2015 at 14:23:38 UTC, Steven Schveighoffer wrote: If CTFE associative arrays perform differently, then that is a bug. I am not sure if this is the case, but you should file a bug anyway, someone can take a look at it. If you can narrow it down to a minimal case where it

Re: Something about Chinese Disorder Code

2015-11-24 Thread Marco Leise via Digitalmars-d-learn
Am Tue, 24 Nov 2015 17:08:33 + schrieb BLM768 : > On Tuesday, 24 November 2015 at 09:48:45 UTC, magicdmer wrote: > > I display chinese string like: > > > > auto str = "你好,世界" > > writeln(str) > > > > and The display is garbled。 > > > > some windows api like MessageBoxA ,if string is chinese, i

Re: Communicating with external processes in D

2015-11-24 Thread Jesse Phillips via Digitalmars-d-learn
On Monday, 23 November 2015 at 20:02:16 UTC, Cameron Reid wrote: I'm rather new to D, so apologies if this is a silly question: I'd like to be able to fork a number of instances of a process, write to their stdins and read from their stdouts in parallel. That is, I want to write some data to t

Re: How to use D parallel functions/library

2015-11-24 Thread anonymous via Digitalmars-d-learn
On 24.11.2015 19:49, Bishop120 wrote: I figured this would be a simple parallel foreach function with an iota range of sizeX and just making int X declared inside the function so that I didnt have to worry about shared variable but I cant get around the alive++ reduction and I dont understand eno

Creating D bindings for a C library

2015-11-24 Thread Joseph Rushton Wakeling via Digitalmars-d-learn
Hello all, I'm considering creating some D bindings for a C library. Before I start, I was wondering if anyone could advise me on the current state-of-the-art in automatically converting C headers to .d or .di files; it's a long time since I've looked at anything to do with this and the inte

Re: Creating D bindings for a C library

2015-11-24 Thread Joseph Rushton Wakeling via Digitalmars-d-learn
On Tuesday, 24 November 2015 at 23:14:14 UTC, Joseph Rushton Wakeling wrote: I'm considering creating some D bindings for a C library. I should probably clarify that I know what to do assuming I have to write all the bindings manually. However, as the library has quite a lot of header files,

Re: Creating D bindings for a C library

2015-11-24 Thread cym13 via Digitalmars-d-learn
On Tuesday, 24 November 2015 at 23:22:24 UTC, Joseph Rushton Wakeling wrote: On Tuesday, 24 November 2015 at 23:14:14 UTC, Joseph Rushton Wakeling wrote: I'm considering creating some D bindings for a C library. I should probably clarify that I know what to do assuming I have to write all the

Re: AA behaves differently in CTFE?

2015-11-24 Thread Steven Schveighoffer via Digitalmars-d-learn
On 11/24/15 2:43 PM, Bastiaan Veelo wrote: On Tuesday, 24 November 2015 at 14:23:38 UTC, Steven Schveighoffer wrote: If CTFE associative arrays perform differently, then that is a bug. I am not sure if this is the case, but you should file a bug anyway, someone can take a look at it. If you can

Re: Something about Chinese Disorder Code

2015-11-24 Thread Rikki Cattermole via Digitalmars-d-learn
On 25/11/15 1:47 AM, Meta wrote: On Tuesday, 24 November 2015 at 09:52:21 UTC, Rikki Cattermole wrote: On 24/11/15 10:48 PM, magicdmer wrote: I display chinese string like: auto str = "你好,世界" writeln(str) and The display is garbled。 some windows api like MessageBoxA ,if string is chinese, it

switch with enum

2015-11-24 Thread tcak via Digitalmars-d-learn
I have seen a code a while ago, but even by looking at documentation, I couldn't have found anything about it. Let's say I have defined an enum; enum Status: ubyte{ Busy = 1, Active = 2 } and received a ubyte value from user. ubyte userValue; I want to switch over userValue, but that shoul

Re: switch with enum

2015-11-24 Thread Steven Schveighoffer via Digitalmars-d-learn
On 11/24/15 10:51 PM, tcak wrote: I have seen a code a while ago, but even by looking at documentation, I couldn't have found anything about it. Let's say I have defined an enum; enum Status: ubyte{ Busy = 1, Active = 2 } and received a ubyte value from user. ubyte userValue; I want to s

Re: Something about Chinese Disorder Code

2015-11-24 Thread magicdmer via Digitalmars-d-learn
On Tuesday, 24 November 2015 at 19:41:12 UTC, Marco Leise wrote: Am Tue, 24 Nov 2015 17:08:33 + schrieb BLM768 : [...] thank you for your answers. I solved it. windows console like: fwide(core.stdc.stdio.stdout, 1); setlocale(0, cast(char*)"china"); auto str = "你好,世界"; writeln(str); Mess

Re: switch with enum

2015-11-24 Thread tcak via Digitalmars-d-learn
On Wednesday, 25 November 2015 at 03:59:01 UTC, Steven Schveighoffer wrote: On 11/24/15 10:51 PM, tcak wrote: I have seen a code a while ago, but even by looking at documentation, I couldn't have found anything about it. Let's say I have defined an enum; enum Status: ubyte{ Busy = 1, Acti

Re: How to use D parallel functions/library

2015-11-24 Thread thedeemon via Digitalmars-d-learn
On Tuesday, 24 November 2015 at 18:49:25 UTC, Bishop120 wrote: I figured this would be a simple parallel foreach function with an iota range of sizeX and just making int X declared inside the function so that I didnt have to worry about shared variable but I cant get around the alive++ reductio

convertion of type tuple to enum

2015-11-24 Thread drug via Digitalmars-d-learn
What is the best way to do subj? I did ``` import std.array: array; import std.typetuple: TypeTuple; import std.typecons: tuple; import std.traits: EnumMembers; struct Foo {} struct Bar {} struct FooBar {} struct Baz {} string convertTypeTupleToEnum(Types...)() { string s = "enum Kind {