Re: winsamp.d dont compiler.

2016-07-31 Thread Cassio Butrico via Digitalmars-d-learn
On Monday, 1 August 2016 at 00:27:27 UTC, Sean Campbell wrote: On Sunday, 31 July 2016 at 23:36:54 UTC, Cassio Butrico wrote: [...] There was changes made to core.sys.windows so it defaults to unicode. Try dmd winsamp gdi32.lib winsamp.def -version=ANSI or change all of the xxxA functions

Re: winsamp.d dont compiler.

2016-07-31 Thread Sean Campbell via Digitalmars-d-learn
On Sunday, 31 July 2016 at 23:36:54 UTC, Cassio Butrico wrote: in C:\d\dmd2\samples\d winsamp.d dont compiler. dmd winsamp gdi32.lib winsamp.def winsamp.d(53): Error: function core.sys.windows.winuser.LoadIconA (void*, const(char)*) is not callable using argument types (typeof(null), wchar*)

winsamp.d dont compiler.

2016-07-31 Thread Cassio Butrico via Digitalmars-d-learn
in C:\d\dmd2\samples\d winsamp.d dont compiler. dmd winsamp gdi32.lib winsamp.def winsamp.d(53): Error: function core.sys.windows.winuser.LoadIconA (void*, const(char)*) is not callable using argument types (typeof(null), wchar*) winsamp.d(54): Error: function

Re: FP magic in std.math.pow

2016-07-31 Thread Stefan Koch via Digitalmars-d-learn
On Sunday, 31 July 2016 at 22:38:59 UTC, Seb wrote: Consider this short program: void main() { alias S = float; S s1 = 0x1.24c92ep+5; S s2 = -0x1.1c71c8p+0; [...] It's an anoying feature. The reason this is not implemented in dmd is that pow does not map to a simple cpu

FP magic in std.math.pow

2016-07-31 Thread Seb via Digitalmars-d-learn
Consider this short program: void main() { alias S = float; S s1 = 0x1.24c92ep+5; S s2 = -0x1.1c71c8p+0; import std.math : std_pow = pow; import core.stdc.stdio : printf; import core.stdc.math: powf; printf("std: %a\n", std_pow(s1, s2)); printf("pow: %a\n", s1

Re: Converting int to dchar?

2016-07-31 Thread Darren via Digitalmars-d-learn
That's a really informative response. Thank you!

Re: Converting int to dchar?

2016-07-31 Thread Johannes Loher via Digitalmars-d-learn
Am 31.07.2016 um 23:46 schrieb Seb: > On Sunday, 31 July 2016 at 21:31:52 UTC, Darren wrote: >> Hey, all. >> >> I'm pretty much a programming novice, so I hope you can bear with me. >> Does anyone know how I can change an int into a char equivalent? >> >> e.g. >> int i = 5; >> dchar value; >>

Re: Converting int to dchar?

2016-07-31 Thread ag0aep6g via Digitalmars-d-learn
On 07/31/2016 11:31 PM, Darren wrote: If I try and cast it to dchar, I get messed up output, Because it gives you a dchar with the numeric value 5 which is some control character. and I'm not sure how to use toChars (if that can accomplish this). value = i.toChars.front; toChars

Re: Converting int to dchar?

2016-07-31 Thread Seb via Digitalmars-d-learn
On Sunday, 31 July 2016 at 21:31:52 UTC, Darren wrote: Hey, all. I'm pretty much a programming novice, so I hope you can bear with me. Does anyone know how I can change an int into a char equivalent? e.g. int i = 5; dchar value; ? assert(value == '5'); If I try and cast it to dchar, I

Converting int to dchar?

2016-07-31 Thread Darren via Digitalmars-d-learn
Hey, all. I'm pretty much a programming novice, so I hope you can bear with me. Does anyone know how I can change an int into a char equivalent? e.g. int i = 5; dchar value; ? assert(value == '5'); If I try and cast it to dchar, I get messed up output, and I'm not sure how to use

Re: Cannot compare object.opEquals is not nogc

2016-07-31 Thread ag0aep6g via Digitalmars-d-learn
On 07/31/2016 08:43 PM, Rufus Smith wrote: e.g., I have a nogc container and a remove(T obj). I can't search for obj and remove it because opEquals is not marked nogc. So I need an alternative that is somewhat robust. Jonathan M Davis has already mentioned his plans to templatize

Re: Empty LST files?

2016-07-31 Thread Thalamus via Digitalmars-d-learn
On Sunday, 31 July 2016 at 17:01:32 UTC, Seb wrote: On Sunday, 31 July 2016 at 16:55:52 UTC, Seb wrote: On Sunday, 31 July 2016 at 16:48:52 UTC, Thalamus wrote: On Sunday, 31 July 2016 at 16:08:49 UTC, Seb wrote: On Sunday, 31 July 2016 at 15:30:46 UTC, Thalamus wrote: [...] How about

Re: Why Does Dscanner Warn About a Missing toHash if opEquals is Defined?

2016-07-31 Thread Jack Stouffer via Digitalmars-d-learn
On Sunday, 31 July 2016 at 17:48:48 UTC, BLM768 wrote: writeln(n1.hashOf == n2.hashOf); // false = BAD! Ok, yeah that is bad. Next question: what's the fastest hashing implementation that will provide the least collisions? Is there a hash implementation that's perfered for AAs?

Re: Cannot compare object.opEquals is not nogc

2016-07-31 Thread Rufus Smith via Digitalmars-d-learn
On Monday, 25 July 2016 at 12:24:53 UTC, Steven Schveighoffer wrote: On 7/23/16 5:44 PM, Rufus Smith wrote: [...] Again, I want to stress that Object.opEquals has been around since early D1 days, @nogc is only a few years old, it was not a wrong decision. @nogc cannot be added without

Re: Cannot compare object.opEquals is not nogc

2016-07-31 Thread Rufus Smith via Digitalmars-d-learn
On Saturday, 23 July 2016 at 13:18:03 UTC, Rufus Smith wrote: Trying to compare a *ptr value with a value in nogc code results in the error: Error: @nogc function '...' cannot call non-@nogc function 'object.opEquals' Shouldn't object opEquals be marked? So, I need to compare two

Re: Why D isn't the next "big thing" already

2016-07-31 Thread Gorge Jingale via Digitalmars-d-learn
On Sunday, 31 July 2016 at 10:11:46 UTC, LaTeigne wrote: On Saturday, 30 July 2016 at 12:24:55 UTC, ketmar wrote: On Saturday, 30 July 2016 at 12:18:08 UTC, LaTeigne wrote: it you think that you know the things better than somebody who actually *lived* there in those times... well, keep

Re: Why D isn't the next "big thing" already

2016-07-31 Thread Jon Degenhardt via Digitalmars-d-learn
On Saturday, 30 July 2016 at 22:52:23 UTC, bachmeier wrote: On Saturday, 30 July 2016 at 12:30:55 UTC, LaTeigne wrote: On Saturday, 30 July 2016 at 12:24:55 UTC, ketmar wrote: On Saturday, 30 July 2016 at 12:18:08 UTC, LaTeigne wrote: it you think that you know the things better than somebody

Re: Why Does Dscanner Warn About a Missing toHash if opEquals is Defined?

2016-07-31 Thread BLM768 via Digitalmars-d-learn
On Sunday, 31 July 2016 at 16:39:59 UTC, Jack Stouffer wrote: But D provides a default toHash for every type if it's not defined. I was wondering why not just rely on that version. If two objects are equal, their hashes must also be equal. Consider this example: struct Nullable(T) { bool

Re: Empty LST files?

2016-07-31 Thread Seb via Digitalmars-d-learn
On Sunday, 31 July 2016 at 16:55:52 UTC, Seb wrote: On Sunday, 31 July 2016 at 16:48:52 UTC, Thalamus wrote: On Sunday, 31 July 2016 at 16:08:49 UTC, Seb wrote: On Sunday, 31 July 2016 at 15:30:46 UTC, Thalamus wrote: [...] How about setting the source path directly? With a recent enough

Re: Empty LST files?

2016-07-31 Thread Seb via Digitalmars-d-learn
On Sunday, 31 July 2016 at 16:48:52 UTC, Thalamus wrote: On Sunday, 31 July 2016 at 16:08:49 UTC, Seb wrote: On Sunday, 31 July 2016 at 15:30:46 UTC, Thalamus wrote: On Sunday, 31 July 2016 at 14:03:49 UTC, Thalamus wrote: [...] After a couple more hours today, I found a couple of

Re: Empty LST files?

2016-07-31 Thread Thalamus via Digitalmars-d-learn
On Sunday, 31 July 2016 at 16:08:49 UTC, Seb wrote: On Sunday, 31 July 2016 at 15:30:46 UTC, Thalamus wrote: On Sunday, 31 July 2016 at 14:03:49 UTC, Thalamus wrote: [...] After a couple more hours today, I found a couple of solutions. Neither is satisfactory. [...] How about setting

Re: Why Does Dscanner Warn About a Missing toHash if opEquals is Defined?

2016-07-31 Thread Jack Stouffer via Digitalmars-d-learn
On Sunday, 31 July 2016 at 15:30:15 UTC, LaTeigne wrote: On Sunday, 31 July 2016 at 15:21:01 UTC, Jack Stouffer wrote: Is it really a problem? What are the pitfalls of defining one but not the other? iirc usage in an AA requires both. But D provides a default toHash for every type if it's

Re: Empty LST files?

2016-07-31 Thread Seb via Digitalmars-d-learn
On Sunday, 31 July 2016 at 15:30:46 UTC, Thalamus wrote: On Sunday, 31 July 2016 at 14:03:49 UTC, Thalamus wrote: [...] After a couple more hours today, I found a couple of solutions. Neither is satisfactory. [...] How about setting the source path directly? With a recent enough dmd

Re: Empty LST files?

2016-07-31 Thread Thalamus via Digitalmars-d-learn
On Sunday, 31 July 2016 at 14:03:49 UTC, Thalamus wrote: On Sunday, 31 July 2016 at 10:05:04 UTC, Basile B. wrote: On Sunday, 31 July 2016 at 08:29:47 UTC, Basile B. wrote: On Sunday, 31 July 2016 at 01:10:40 UTC, Thalamus wrote: Any idea what I'm doing wrong? Yes, what's going wrong is

Re: Why Does Dscanner Warn About a Missing toHash if opEquals is Defined?

2016-07-31 Thread LaTeigne via Digitalmars-d-learn
On Sunday, 31 July 2016 at 15:21:01 UTC, Jack Stouffer wrote: Is it really a problem? What are the pitfalls of defining one but not the other? iirc usage in an AA requires both.

Why Does Dscanner Warn About a Missing toHash if opEquals is Defined?

2016-07-31 Thread Jack Stouffer via Digitalmars-d-learn
Is it really a problem? What are the pitfalls of defining one but not the other?

Re: null as parametr

2016-07-31 Thread Andrew Godfrey via Digitalmars-d-learn
On Sunday, 31 July 2016 at 05:41:55 UTC, AntonSotov wrote: 2 Seb Thank you! is (T: typeof (null)) - very comfortable An example of Seb's warning: What happens if you have: string s = null; MyFunc(s); I'm guessing it doesn't do what you want. But it isn't clear what you want - null is a

Re: Empty LST files?

2016-07-31 Thread Thalamus via Digitalmars-d-learn
On Sunday, 31 July 2016 at 10:05:04 UTC, Basile B. wrote: On Sunday, 31 July 2016 at 08:29:47 UTC, Basile B. wrote: On Sunday, 31 July 2016 at 01:10:40 UTC, Thalamus wrote: Any idea what I'm doing wrong? Yes, what's going wrong is quite actually you said that the LST is well generated but

Re: [OT] Re: Why D isn't the next "big thing" already

2016-07-31 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 31 July 2016 at 04:51:13 UTC, bachmeier wrote: But this would be our own subreddit. I don't disagree if you're talking about r/programming. Oh, the people are terrible, but the platform is worse - I don't like the tree view nor the voting system. It makes it really hard to follow

Re: Use dup on Containers with const Elements

2016-07-31 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/30/16 5:21 PM, Q. Schroll wrote: On Friday, 29 July 2016 at 19:24:59 UTC, Steven Schveighoffer wrote: On 7/29/16 3:00 PM, Q. Schroll wrote: Cases to consider: Arrays and AAs with const(T) Elements, where T is a value or a reference type respectively. [snip] Questions: (1) Why do I have

Re: Why D isn't the next "big thing" already

2016-07-31 Thread LaTeigne via Digitalmars-d-learn
On Saturday, 30 July 2016 at 12:24:55 UTC, ketmar wrote: On Saturday, 30 July 2016 at 12:18:08 UTC, LaTeigne wrote: it you think that you know the things better than somebody who actually *lived* there in those times... well, keep thinking that. also, don't forget to teach physics to

Question regarding Base64 decoding

2016-07-31 Thread Johannes Loher via Digitalmars-d-learn
Currently, the function Base64.decode for decoding char[] to ubyte[] has an in contract, that should ensure that the supplied buffer is large enough. However, it uses the function decodeLength, which does not give the accurate decodeLength, but instead an upper bound (decodeLength can be up to 2

Re: Empty LST files?

2016-07-31 Thread Basile B. via Digitalmars-d-learn
On Sunday, 31 July 2016 at 08:29:47 UTC, Basile B. wrote: On Sunday, 31 July 2016 at 01:10:40 UTC, Thalamus wrote: Any idea what I'm doing wrong? Yes, what's going wrong is quite actually you said that the LST is well generated but empty so my previous answer is wrong, also i was focused

Re: std.socket Socket.select failing on consecutive calls with listening socket

2016-07-31 Thread cc via Digitalmars-d-learn
On Sunday, 31 July 2016 at 08:29:10 UTC, ketmar wrote: On Sunday, 31 July 2016 at 08:00:02 UTC, cc wrote: socket sets usually updated after call to `select()`. you have to recreate the sets before each call. Ah that works, thanks.

Re: Empty LST files?

2016-07-31 Thread Basile B. via Digitalmars-d-learn
On Sunday, 31 July 2016 at 01:10:40 UTC, Thalamus wrote: I'm running into a problem where when I specify -cov in the DMD compiler command, the coverage LST files are generated, but they're all empty. Has anyone else run into this before? My command line is: dmd -m64 -gc -debug -w -wi -cov -X

Re: std.socket Socket.select failing on consecutive calls with listening socket

2016-07-31 Thread ketmar via Digitalmars-d-learn
On Sunday, 31 July 2016 at 08:00:02 UTC, cc wrote: socket sets usually updated after call to `select()`. you have to recreate the sets before each call.

Re: Template Inheritance

2016-07-31 Thread Nicholas Wilson via Digitalmars-d-learn
On Sunday, 31 July 2016 at 03:04:27 UTC, Gorge Jingale wrote: I like to build structures using template mixins because one can pick and choose functionality at compile time, but still have a relationship between different types. It would be really nice if one could sort of test if a template

std.socket Socket.select failing on consecutive calls with listening socket

2016-07-31 Thread cc via Digitalmars-d-learn
Socket server = new TcpSocket(); server.setOption(SocketOptionLevel.SOCKET, SocketOption.REUSEADDR, true); server.bind(new InternetAddress(8000)); server.listen(8); auto set = new SocketSet(); set.add(server); auto sel = Socket.select(set,