Re: Windows 64

2013-10-07 Thread Rainer Schuetze
On 08.10.2013 01:26, "Casper Færgemand" " wrote: And I'm done. The problem was this: LIB=%@P%\..\lib;%VCINSTALLDIR%\lib\amd64;%WindowsSdkDir%\Lib\x64 The lib folder linked first contains kernel32.lib and shell32.lib. Removing both made -m64 possible, but killed -m32. Changing it to this: LIB=%V

Re: cascade operator or nearest equivalent

2013-10-07 Thread Daniel Davidson
On Thursday, 12 September 2013 at 19:41:49 UTC, bearophile wrote: Daniel Davidson: I am using Dart for code generation but would like to consider D if I can find a convenient replacement for the following declarative style: Replacing Dart with D seems quite strange, such two languages have

Re: Windows 64

2013-10-07 Thread Casper Færgemand
And I'm done. The problem was this: LIB=%@P%\..\lib;%VCINSTALLDIR%\lib\amd64;%WindowsSdkDir%\Lib\x64 The lib folder linked first contains kernel32.lib and shell32.lib. Removing both made -m64 possible, but killed -m32. Changing it to this: LIB=%VCINSTALLDIR%\lib\amd64;%WindowsSdkDir%\Lib\x64;%@

Re: Scope variables.

2013-10-07 Thread Agustin
On Monday, 7 October 2013 at 23:18:13 UTC, Justin Whear wrote: On Tue, 08 Oct 2013 01:01:43 +0200, Agustin wrote: Doesn't ref means i'm passing the parameter by reference instead of by value?. Isn't "a" being copied when calling func?, or does D always pass by reference when using classes and

Re: Scope variables.

2013-10-07 Thread Justin Whear
On Tue, 08 Oct 2013 01:01:43 +0200, Agustin wrote: > Doesn't ref means i'm passing the parameter by reference instead of by > value?. Isn't "a" being copied when calling func?, or does D always pass > by reference when using classes and structures? Class instances are by reference already, struct

Re: Windows 64

2013-10-07 Thread Casper Færgemand
Okay, it's definitely a problem with dmd passing something bad to link. I was able to link it manually and the program was working fine. import std.stdio; void main() { writeln("Hello Linker!"); } I ran "dmd -m64 test.d". The usual errors were dumped in the terminal. I then ran "link

Re: Scope variables.

2013-10-07 Thread Agustin
On Monday, 7 October 2013 at 22:57:17 UTC, Ali Çehreli wrote: On 10/07/2013 03:52 PM, Agustin wrote: On Monday, 7 October 2013 at 19:59:09 UTC, Agustin wrote: On Monday, 7 October 2013 at 19:58:21 UTC, Agustin wrote: I'm having a hard time trying to use "scoped". public T callEvent(T, A...)(a

Re: Scope variables.

2013-10-07 Thread Justin Whear
On Tue, 08 Oct 2013 00:52:19 +0200, Agustin wrote: > > So i found out that i cannot do this, may i ask why? > > public class A { >int x = 0; > } > > public class B : A { > } > > void func(ref A a) > { > } > > void main() > { >B b = new B(); >func(b); > } Get rid of the "ref" in fu

Re: Scope variables.

2013-10-07 Thread Ali Çehreli
On 10/07/2013 03:52 PM, Agustin wrote: On Monday, 7 October 2013 at 19:59:09 UTC, Agustin wrote: On Monday, 7 October 2013 at 19:58:21 UTC, Agustin wrote: I'm having a hard time trying to use "scoped". public T callEvent(T, A...)(auto ref A args) const { T pEvent = scoped!T(forward!args); po

Re: Scope variables.

2013-10-07 Thread Agustin
On Monday, 7 October 2013 at 19:59:09 UTC, Agustin wrote: On Monday, 7 October 2013 at 19:58:21 UTC, Agustin wrote: I'm having a hard time trying to use "scoped". public T callEvent(T, A...)(auto ref A args) const { T pEvent = scoped!T(forward!args); postEvent(pEvent, typeid(T).toHash); retu

Re: Windows 64

2013-10-07 Thread Casper Færgemand
More searching suggests all the unresolved external symbols are found in the lib files in v7.1\Lib\x64\ I'm guessing the linker doesn't know this. Any easy way to tell it where to look? Does the linker have an include folder? I tried with -LPATH"%WindowsSdkDir%\Lib\x64" as well as -L+"C:\Program

Re: Getting the missing Windows functions

2013-10-07 Thread Andrej Mitrovic
On 10/7/13, Matt wrote: > The missing functions (or at least the one I'm interested in at > the moment) that I'm trying to use are supposed to be IN > kernel32, and have been in there since Windows Vista. That's why > I'm a little confused. The kernel32.lib distributed with DMD is likely out of d

Re: Windows 64

2013-10-07 Thread Casper Færgemand
A lot of deleted posts and a lot of stupid later, v7.1 SDK is apparently installed in Program Files and not Program Files (x86). Kinda obvious given the names of said folders, but whatever. x.x The x64 version does indeed have an x64 folder in the Lib folder. However, all that aside, still th

Re: std.parallelism amap not scaling?

2013-10-07 Thread safety0ff
I think I've found the culprit: Memory managment / GC, disabling the GC caused the program to eat up all my memory. I'll have to look into this later.

Re: std.parallelism amap not scaling?

2013-10-07 Thread safety0ff
Ok, well I re-wrote the parallelism amap into spawning/joining threads and the results are similar, except notably less system calls (specifically, less futex calls.)

Re: Get unique id of a class type.

2013-10-07 Thread Agustin
On Monday, 7 October 2013 at 19:24:32 UTC, Agustin wrote: On Monday, 7 October 2013 at 19:07:19 UTC, simendsjo wrote: On Monday, 7 October 2013 at 18:55:58 UTC, Agustin wrote: I'm looking a way to get the unique id of a class. I'm able to do this in C++ using type_info::hash_code(). void func

Re: Getting the missing Windows functions

2013-10-07 Thread Matt
On Monday, 7 October 2013 at 14:45:35 UTC, Andrej Mitrovic wrote: On 10/7/13, Matt wrote: I have never had to specify any Windows libs for linking under DMD. What is different about these? DMD links in user32.lib and kernel32.lib by default. But if you want to use other libs like GDI you're

Re: Windows 64

2013-10-07 Thread Casper Færgemand
I have four folders in the SDK folder: v7.0A, v7.1, v8.0 and v8.0A. The latter three contain nothing but a few files, presumably installed by VS 11 or something else. I'm currently trying to install v7.1.

Re: Windows 64

2013-10-07 Thread Casper Færgemand
On Monday, 7 October 2013 at 17:48:13 UTC, Rainer Schuetze wrote: Maybe the WindowsSdkDir environment variable is not set in your console. For the Windows 8 SDK, the standard location of the x64 libraries is "c:\Program Files (x86)\Windows Kits\8.0\Lib\win8\um\x64" for the Windows 7 SDK or pr

Re: isAsciiString in Phobos?

2013-10-07 Thread monarch_dodra
On Monday, 7 October 2013 at 16:23:12 UTC, Andrej Mitrovic wrote: On 10/7/13, monarch_dodra wrote: If we want even more efficiency, we could iterate on the string, interpreting it as a size_t[]. We mask each of its elements with 0x80808080/0x80808080_80808080, and if one of the resulting mask

Scope variables.

2013-10-07 Thread Agustin
I'm having a hard time trying to use "scoped". public T callEvent(T, A...)(auto ref A args) const { T pEvent = scoped!T(forward!args); postEvent(pEvent, typeid(T).toHash); return pEvent; } private void postEvent(ref Event event, Event.ID type) const { } src\event\EventManager.d(37)

Re: Scope variables.

2013-10-07 Thread Agustin
On Monday, 7 October 2013 at 19:58:21 UTC, Agustin wrote: I'm having a hard time trying to use "scoped". public T callEvent(T, A...)(auto ref A args) const { T pEvent = scoped!T(forward!args); postEvent(pEvent, typeid(T).toHash); return pEvent; } private void postEvent(ref Event event, Ev

Re: Get unique id of a class type.

2013-10-07 Thread Agustin
On Monday, 7 October 2013 at 19:07:19 UTC, simendsjo wrote: On Monday, 7 October 2013 at 18:55:58 UTC, Agustin wrote: I'm looking a way to get the unique id of a class. I'm able to do this in C++ using type_info::hash_code(). void function(T) { auto id = typeid(T).getHash(); // Something li

Re: Get unique id of a class type.

2013-10-07 Thread simendsjo
On Monday, 7 October 2013 at 18:55:58 UTC, Agustin wrote: I'm looking a way to get the unique id of a class. I'm able to do this in C++ using type_info::hash_code(). void function(T) { auto id = typeid(T).getHash(); // Something like this? // I know i could write this but seems ugly to

std.parallelism amap not scaling?

2013-10-07 Thread safety0ff
Hello, I tried converting a c++/go ray tracing benchmark [1] to D [2]. I tried to using std.parallelism amap to implement parallelism, but it does not seem to scale in the manner I expect. By running the program with different numbers of threads in the thread pool, I got these results (core i

Get unique id of a class type.

2013-10-07 Thread Agustin
I'm looking a way to get the unique id of a class. I'm able to do this in C++ using type_info::hash_code(). void function(T) { auto id = typeid(T).getHash(); // Something like this? // I know i could write this but seems ugly to me :/ auto id = typeid(string).getHash(typeid(T).name);

Re: mutable, const, immutable guidelines

2013-10-07 Thread Ali Çehreli
On 10/02/2013 10:07 AM, Ali Çehreli wrote: > On 10/02/2013 06:09 AM, Daniel Davidson wrote: > > > I'm reviewing Ali's insightful presentation from 2013 DConf. I > > wonder has he or anyone else followed up on the concepts or > > formalized some guidelines that could achieve consensus. > > I ha

Re: Windows 64

2013-10-07 Thread Rainer Schuetze
On 07.10.2013 12:21, "Casper Færgemand" " wrote: On Monday, 7 October 2013 at 07:03:39 UTC, Rainer Schuetze wrote: The linker does not find the import libraries from the Windows SDK, so it hits the 32-bit libraries that come with dmd. The released sc.ini does not work with VS2012+ or a Window

Re: Using ReadWriteMutex with synchronized{} ?

2013-10-07 Thread Sönke Ludwig
Am 06.10.2013 23:25, schrieb E.S. Quinn: I need to share an associative array between two threads, and to that extent I'd like to make the whole thing synchronized. And I'd like to use the built-in synchronized{} blocks, and I'd also like to use the ReadWriteMutex from core.sync.rwmutex, since it

Re: isAsciiString in Phobos?

2013-10-07 Thread Andrej Mitrovic
On 10/7/13, monarch_dodra wrote: > If we want even more efficiency, we could iterate on the string, > interpreting it as a size_t[]. We mask each of its elements with > 0x80808080/0x80808080_80808080, and if one of the resulting > masked elements is not null, then the string isn't ASCII. Clever!

Re: isAsciiString in Phobos?

2013-10-07 Thread monarch_dodra
On Monday, 7 October 2013 at 15:57:15 UTC, Andrej Mitrovic wrote: On 10/7/13, Adam D. Ruppe wrote: If you want strict ASCII, it should be <= 127 rather than 255 because the high bit can be all kinds of different encodings (the first 255 of unicode codepoints I think match latin-1 numerically,

Re: isAsciiString in Phobos?

2013-10-07 Thread Andrej Mitrovic
On 10/7/13, Adam D. Ruppe wrote: > If you want strict ASCII, it should be <= 127 rather than 255 > because the high bit can be all kinds of different encodings (the > first 255 of unicode codepoints I think match latin-1 > numerically, but that's different than windows-1252 or various > non-Englis

Re: isAsciiString in Phobos?

2013-10-07 Thread Jonathan M Davis
On Monday, October 07, 2013 17:17:57 Andrej Mitrovic wrote: > If I want to transfer some string to a C function that expects > ascii-only string. What can I use to verify there are no non-ascii > characters in a D string? I haven't seen anything in Phobos. > > I was thinking of using: > > bool is

Re: isAsciiString in Phobos?

2013-10-07 Thread Adam D. Ruppe
On Monday, 7 October 2013 at 15:18:06 UTC, Andrej Mitrovic wrote: bool isAscii = mystring.all!(a => a <= 0xFF); If you want strict ASCII, it should be <= 127 rather than 255 because the high bit can be all kinds of different encodings (the first 255 of unicode codepoints I think match latin-1

Re: isAsciiString in Phobos?

2013-10-07 Thread Andrej Mitrovic
On 10/7/13, Andrej Mitrovic wrote: > If I want to transfer some string to a C function that expects > ascii-only string. Minus the "If".

isAsciiString in Phobos?

2013-10-07 Thread Andrej Mitrovic
If I want to transfer some string to a C function that expects ascii-only string. What can I use to verify there are no non-ascii characters in a D string? I haven't seen anything in Phobos. I was thinking of using: bool isAscii = mystring.all!(a => a <= 0xFF); Is this safe? I'm thinking of whe

std.math.abs and shared/const/immutable BigInts

2013-10-07 Thread Joseph Rushton Wakeling
Hello all, I recently discovered this issue with std.bigint.BigInt and std.math.abs: http://d.puremagic.com/issues/show_bug.cgi?id=11188 In short, the following code: import std.bigint, std.math, std.typetuple; auto foo(T)() { T n = -3; return std.math.abs(n); } void mai

Re: Getting the missing Windows functions

2013-10-07 Thread Andrej Mitrovic
On 10/7/13, Matt wrote: > I have never had to specify any Windows libs for linking under > DMD. What is different about these? DMD links in user32.lib and kernel32.lib by default. But if you want to use other libs like GDI you're going to have to pass them at the command line.

Re: How to add time to Clock.currTime

2013-10-07 Thread JohnnyK
On Saturday, 5 October 2013 at 02:42:49 UTC, Jonathan M Davis wrote: On Saturday, October 05, 2013 03:31:33 JohnnyK wrote: Wow I appreciate the quick response. Ok I have seen this before. What is the dur? Where is dur defined? Also I am confused how 300.seconds would work. How can a literal num

Re: Windows 64

2013-10-07 Thread Casper Færgemand
On Monday, 7 October 2013 at 07:03:39 UTC, Rainer Schuetze wrote: The linker does not find the import libraries from the Windows SDK, so it hits the 32-bit libraries that come with dmd. The released sc.ini does not work with VS2012+ or a Windows SDK 8, you should add the following lines to it:

Re: A few questions about safe concurrent programming assumptions

2013-10-07 Thread John Colvin
On Monday, 7 October 2013 at 05:26:10 UTC, Nicholas Smith wrote: Thanks Jonathon, these are the kinds of warnings I was looking for. There are _no_ guarantees of atomicity with shared. Yes, on some architectures, writing a word size might be atomic, but the language guarantees no such thing.

Re: Windows 64

2013-10-07 Thread Rainer Schuetze
On 07.10.2013 03:31, "Casper Færgemand" " wrote: Hey, I've been trying for a while to compile 64 bit programs on a Windows 7 platform. The setup is the following: Version: 2.063.2 OS: Windows 7 64 Linked: VS 11 64 bit linker sc.ini: [Version] version=7.51 Build 020 [Environment] LIB="%@P%\.