Re: opCmp with double values

2017-12-24 Thread drug via Digitalmars-d-learn
25.12.2017 10:40, drug пишет: 25.12.2017 09:50, Ali Çehreli пишет: On 12/24/2017 02:10 AM, kerdemdemir wrote:  >  if (  fabs(diff) < 0.0001 ) I can't answer your question but I know that the comparison above is wrong because it can be meaningful only if the values are sufficiently

Re: opCmp with double values

2017-12-24 Thread drug via Digitalmars-d-learn
25.12.2017 09:50, Ali Çehreli пишет: On 12/24/2017 02:10 AM, kerdemdemir wrote: >  if (  fabs(diff) < 0.0001 ) I can't answer your question but I know that the comparison above is wrong because it can be meaningful only if the values are sufficiently larger than that hard-coded v

Re: opCmp with double values

2017-12-24 Thread Ali Çehreli via Digitalmars-d-learn
On 12/24/2017 02:10 AM, kerdemdemir wrote: > if ( fabs(diff) < 0.0001 ) I can't answer your question but I know that the comparison above is wrong because it can be meaningful only if the values are sufficiently larger than that hard-coded value. I think feqrel() will be useful

Re: indexing stuff during compile time

2017-12-24 Thread Eric via Digitalmars-d-learn
I am just a bit confused why I had to use tuple() while the doc Because of the enum, that code was full of errors :/ Got it now: auto groupIndex(Ts...)() { import std.meta; import std.algorithm.comparison : cmp, strcmp = cmp; enum Comp(N1, N2) = strcmp(N1.stringof, N2.s

Re: indexing stuff during compile time

2017-12-24 Thread Eric via Digitalmars-d-learn
Ok, solved. It appears you can sort tuples. I am just a bit confused why I had to use tuple() while the doc for staticSort states it works on AliasSeq. auto groupIndex(Ts...)() { import std.meta; enum Comp(alias N1, alias N2) = { __traits(identifier, typeof(N1)) < __traits(identifier

Re: nested module problem

2017-12-24 Thread Luís Marques via Digitalmars-d-learn
On Sunday, 24 December 2017 at 22:17:23 UTC, Luís Marques wrote: I think that shouldn't be allowed. You have a package foo, but use a normal module instead of foo/package.d. I'm going to file a bug on that.

Re: nested module problem

2017-12-24 Thread Luís Marques via Digitalmars-d-learn
On Saturday, 2 September 2017 at 20:03:48 UTC, Jean-Louis Leroy wrote: jll@ORAC:~/dev/d/tests/modules$ tree . ├── foo │ └── bar.d └── foo.d I think that shouldn't be allowed. You have a package foo, but use a normal module instead of foo/package.d. I'm going to file a bug on that.

Re: indexing stuff during compile time

2017-12-24 Thread Eric via Digitalmars-d-learn
Forgot to mention that I also want groupIndex!(A,B) == groupIndex!(B,A) Which I wanted to do by sorting the names. If that requirement wasn't there it would be as simple as: auto groupIndex(Ts...)() { return GroupId!Ts.id; } size_t s_nextIdx=1; struct GroupId(Ts ...) { static size_t id;

Re: can't run libuid examples

2017-12-24 Thread greatsam4sure via Digitalmars-d-learn
On Friday, 22 December 2017 at 04:41:09 UTC, bauss wrote: On Thursday, 21 December 2017 at 18:41:28 UTC, greatsam4sure wrote: I am having problem with running the examples of libuid on Windows and how to use libuid on a project without errors. I am using dmd version 2.076 Okay, but how are we

Re: Don't expect class destructors to be called at all by the GC

2017-12-24 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, December 22, 2017 01:23:26 Mike Parker via Digitalmars-d-learn wrote: > The class destructor is not run during the lifetime of the > program. The fact that it's run during runtime termination is an > implementation detail. Another implementation might not run a > finalization at termina

Re: DerelictGL3 glGenBuffers segmentation fault.

2017-12-24 Thread Kevin via Digitalmars-d-learn
On Sunday, 24 December 2017 at 16:27:11 UTC, Mike Parker wrote: On Sunday, 24 December 2017 at 14:48:20 UTC, Kevin wrote: [...] In mygl.d, your import of derelict.opengl needs to be public: module mygl; public import derelict.opengl; mixin glFreeFuncs!(GLVersion.gl33); [...] It doesn'

Re: DerelictGL3 glGenBuffers segmentation fault.

2017-12-24 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 24 December 2017 at 14:48:20 UTC, Kevin wrote: Thanks. That help but know my buffers doesn't recognize opengl types. I created mygl and import it to all files. Updated code on github. source/buffers.d(6,12): Error: undefined identifier GLuint, did you mean alias GLuint64? source/b

Re: DerelictGL3 glGenBuffers segmentation fault.

2017-12-24 Thread Kevin via Digitalmars-d-learn
Thanks. That help but know my buffers doesn't recognize opengl types. I created mygl and import it to all files. Updated code on github. source/buffers.d(6,12): Error: undefined identifier GLuint, did you mean alias GLuint64? source/buffers.d(7,13): Error: undefined identifier GLsizei and more

Re: Does LDC support profiling at all?

2017-12-24 Thread Johan Engelen via Digitalmars-d-learn
On Sunday, 24 December 2017 at 02:48:32 UTC, Chris Katko wrote: It would probably be really helpful to get a clear Wiki guide for this information LDC. I'll write it myself if necessary once I try your recommendations and test them out. This would help us out a lot, thanks. -Johan

Re: betterC current consequences

2017-12-24 Thread rikki cattermole via Digitalmars-d-learn
On 24/12/2017 10:02 AM, Amorphorious wrote: The docs states Consequences As no Druntime is available, many D features won't work. For example:     Garbage Collection     Thread-local storage     TypeInfo and ModuleInfo     Classes     Built-in threading (e.g. core.thread)     Dynamic arra

opCmp with double values

2017-12-24 Thread kerdemdemir via Digitalmars-d-learn
In documentation and forums I found some example for overloading opCmp for int values. But I couldn't see any examples for double values. That is what I come up with my own: struct AdjustableVal ( T = double ) { this ( T initVal ) { curVal = initVal;

Re: Compile to non-OS binary

2017-12-24 Thread Amorphorious via Digitalmars-d-learn
On Sunday, 24 December 2017 at 03:24:36 UTC, Adam D. Ruppe wrote: On Sunday, 24 December 2017 at 03:15:58 UTC, Amorphorious wrote: In fact, it would be very helpful to have switches that disable the various "features" of D that I will not use rather than having to do any self compilation. The

betterC current consequences

2017-12-24 Thread Amorphorious via Digitalmars-d-learn
The docs states Consequences As no Druntime is available, many D features won't work. For example: Garbage Collection Thread-local storage TypeInfo and ModuleInfo Classes Built-in threading (e.g. core.thread) Dynamic arrays (but not slices) and associative arrays Ex