Re: win32 from master: unicode functions by default?

2015-11-13 Thread Kagamin via Digitalmars-d-learn
On Friday, 13 November 2015 at 08:44:33 UTC, Vladimir Panteleev wrote: If only Microsoft would have adopted UTF-8 as an 8-bit locale... if only. Then you would need to do all TCHAR stuff from windows headers in order to conditionally compile for utf-8 for say Windows 20 and for utf-16 for

Re: win32 from master: unicode functions by default?

2015-11-13 Thread Vladimir Panteleev via Digitalmars-d-learn
On Friday, 13 November 2015 at 08:10:12 UTC, Kagamin wrote: On Thursday, 12 November 2015 at 15:58:53 UTC, Jonathan M Davis wrote: It seems pretty wrong for the A versions to be the default though... For my money it's a plain bug in bindings :) Yep, we don't support non-Unicode Windows

Re: win32 from master: unicode functions by default?

2015-11-13 Thread Kagamin via Digitalmars-d-learn
On Thursday, 12 November 2015 at 15:58:53 UTC, Jonathan M Davis wrote: It seems pretty wrong for the A versions to be the default though... For my money it's a plain bug in bindings :) Still, even in C++ code, I've generally taken the approach of using the W functions explicitly in order to

Re: win32 from master: unicode functions by default?

2015-11-13 Thread Kagamin via Digitalmars-d-learn
On Friday, 13 November 2015 at 05:09:12 UTC, Mike Parker wrote: I've gotten into the same habit. But it appears the switch to dynamic loading has made it so that only the A versions or only the W versions are available. You no longer get both.

Re: A new instance of a variable?

2015-11-13 Thread Steven Schveighoffer via Digitalmars-d-learn
On 11/13/15 10:48 AM, Ish wrote: foreach (i; 0..5) { immutable int j = i; etc. } I want each j to be assigned separate memory so that it can be passed to a calle function and not overwritten by next value of i in foreach()?? This is not safe to do. What you are doing is passing a

A new instance of a variable?

2015-11-13 Thread Ish via Digitalmars-d-learn
foreach (i; 0..5) { immutable int j = i; etc. } I want each j to be assigned separate memory so that it can be passed to a calle function and not overwritten by next value of i in foreach()??

Thread in detached state?

2015-11-13 Thread Ish via Digitalmars-d-learn
I was directed here from General list, so be patient with me. I am looking for syntax for creating a detached-state thread in the spirit of POSIX thread attribute PTHREAD_CREATE_DETACHED (the thread resources are released on termination and not when the main thread terminates - allows for a

Re: A new instance of a variable?

2015-11-13 Thread anonymous via Digitalmars-d-learn
On 13.11.2015 18:44, Ish wrote: immutable int* j = new immutable int(i); gives error: locks1.d:27: error: no constructor for immutable(int); Looks like your D version is rather old. I had to go back to dmd 2.065 to see that error. 2.065 is from February 2014. We're at 2.069 now. I'd

Re: A new instance of a variable?

2015-11-13 Thread Marc Schütz via Digitalmars-d-learn
On Friday, 13 November 2015 at 17:44:31 UTC, Ish wrote: On Friday, 13 November 2015 at 16:06:51 UTC, Alex Parrill wrote: On Friday, 13 November 2015 at 15:49:01 UTC, Ish wrote: foreach (i; 0..5) { immutable int j = i; etc. } I want each j to be assigned separate memory so that it can be

Epoch time + msecs

2015-11-13 Thread Handyman via Digitalmars-d-learn
How to get current time as a float (or a double or a real) as a Unix epoch + milliseconds (e.g, 1447437383.465, or even 1447437383.46512 with finer resolution)? I read http://dlang.org/intro-to-datetime.html and the docs of course. I came this far auto ct = Clock.currTime(); auto

Re: Epoch time + msecs

2015-11-13 Thread Steven Schveighoffer via Digitalmars-d-learn
On 11/13/15 1:00 PM, Handyman wrote: How to get current time as a float (or a double or a real) as a Unix epoch + milliseconds (e.g, 1447437383.465, or even 1447437383.46512 with finer resolution)? I read http://dlang.org/intro-to-datetime.html and the docs of course. I came this far auto

Re: A new instance of a variable?

2015-11-13 Thread Ish via Digitalmars-d-learn
On Friday, 13 November 2015 at 18:10:38 UTC, Marc Schütz wrote: On Friday, 13 November 2015 at 17:44:31 UTC, Ish wrote: On Friday, 13 November 2015 at 16:06:51 UTC, Alex Parrill wrote: [...] immutable int* j = new immutable int(i); gives error: locks1.d:27: error: no constructor for

Re: A new instance of a variable?

2015-11-13 Thread Ish via Digitalmars-d-learn
On Friday, 13 November 2015 at 16:06:51 UTC, Alex Parrill wrote: On Friday, 13 November 2015 at 15:49:01 UTC, Ish wrote: foreach (i; 0..5) { immutable int j = i; etc. } I want each j to be assigned separate memory so that it can be passed to a calle function and not overwritten by next

Re: Epoch time + msecs

2015-11-13 Thread Steven Schveighoffer via Digitalmars-d-learn
On 11/13/15 3:15 PM, Handyman wrote: On Friday, 13 November 2015 at 18:27:42 UTC, Steven Schveighoffer wrote: On 11/13/15 1:00 PM, Handyman wrote: What I would do is this: auto t = (Clock.currTime() - SysTime.fromUnixTime(0)).total!"msecs" / 1000.0 Thanks, Steve. import std.stdio;

Re: Epoch time + msecs

2015-11-13 Thread Handyman via Digitalmars-d-learn
On Friday, 13 November 2015 at 18:27:42 UTC, Steven Schveighoffer wrote: On 11/13/15 1:00 PM, Handyman wrote: What I would do is this: auto t = (Clock.currTime() - SysTime.fromUnixTime(0)).total!"msecs" / 1000.0 Thanks, Steve. import std.stdio; import std.datetime; void main() {

Re: Epoch time + msecs

2015-11-13 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, November 13, 2015 18:00:13 Handyman via Digitalmars-d-learn wrote: > How to get current time as a float (or a double or a real) as a > Unix epoch + milliseconds (e.g, 1447437383.465, or even > 1447437383.46512 with finer resolution)? I read > http://dlang.org/intro-to-datetime.html

Bug? Bad file name?

2015-11-13 Thread Anonymous via Digitalmars-d-learn
I was playing with some code someone posted on the forum that involved opDispatch and compile time parameters. I pasted it in a file named templOpDispatch.d, ran it, and got an error. Then I noticed if I renamed the file it worked. The source didn't matter; same thing happens with an empty

Re: I can't believe this !!

2015-11-13 Thread Rikki Cattermole via Digitalmars-d-learn
On 14/11/15 7:30 PM, MesmerizedInTheMorning wrote: https://issues.dlang.org/show_bug.cgi?id=15331 but it's true ! There's **nothing** to check the availability of a Key. At least I would expect opIndex[string key] to return a JSONValue with .type == JSON_TYPE.NULL, but no... Also If it was

Re: I can't believe this !!

2015-11-13 Thread anonymous via Digitalmars-d-learn
On 14.11.2015 07:30, MesmerizedInTheMorning wrote: https://issues.dlang.org/show_bug.cgi?id=15331 but it's true ! There's **nothing** to check the availability of a Key. At least I would expect opIndex[string key] to return a JSONValue with .type == JSON_TYPE.NULL, but no... Also If it was

Re: I can't believe this !!

2015-11-13 Thread MesmerizedInTheMorning via Digitalmars-d-learn
On Saturday, 14 November 2015 at 06:51:14 UTC, anonymous wrote: On 14.11.2015 07:30, MesmerizedInTheMorning wrote: [...] JSONValue supports `in`, though: import std.stdio; import std.json; void main() { foreach (jsonStr; ["{}", "{\"foo\": 42}"]) { JSONValue jsonObj =

I can't believe this !!

2015-11-13 Thread MesmerizedInTheMorning via Digitalmars-d-learn
https://issues.dlang.org/show_bug.cgi?id=15331 but it's true ! There's **nothing** to check the availability of a Key. At least I would expect opIndex[string key] to return a JSONValue with .type == JSON_TYPE.NULL, but no... Also If it was returning a JSONValue* it would be easyer to check