Re: Floating point types default to NaN?

2017-11-28 Thread Michael V. Franklin via Digitalmars-d-learn
On Wednesday, 29 November 2017 at 01:24:21 UTC, A Guy With a Question wrote: I was just more curious of the design decisions that were made. So am I. I'm trying to get to the heart of in the the PR comments. Mike

Re: Floating point types default to NaN?

2017-11-28 Thread Michael V. Franklin via Digitalmars-d-learn
On Monday, 27 November 2017 at 23:05:55 UTC, Michael V. Franklin wrote: I think I'm going to implement a feature gate to require explicit initialization. It would be better to be strict up front and relax it as flow control analysis becomes more mature. Well, I implemented it

Re: Floating point types default to NaN?

2017-11-27 Thread Michael V. Franklin via Digitalmars-d-learn
On Saturday, 25 November 2017 at 22:13:43 UTC, Adam D. Ruppe wrote: It technically did: https://dlang.org/spec/function.html#local-variables "It is an error to use a local variable without first assigning it a value. The implementation may not always be able to detect these cases. Other

Re: DMD test suite assertion failure in test_cdvecfill.d

2017-11-25 Thread Michael V. Franklin via Digitalmars-d-learn
On Tuesday, 21 November 2017 at 10:04:50 UTC, Petar Kirov [ZombineDev] wrote: File a bug report and try contacting Martin Nowak, as he's the author of this test, IIRC. https://issues.dlang.org/show_bug.cgi?id=18013

Re: betterC and noboundscheck

2017-11-24 Thread Michael V. Franklin via Digitalmars-d-learn
On Wednesday, 22 November 2017 at 15:10:40 UTC, Oleg B wrote: import core.stdc.stdio; import std.algorithm : min; extern (C) void main() { char[256] buf; buf[] = '\0'; auto str = "hello world"; auto ln = min(buf.length, str.length); buf[0..ln] = str[0..ln];

Re: Can I count the of enum's fields at compile time?

2017-11-22 Thread Michael V. Franklin via Digitalmars-d-learn
On Thursday, 23 November 2017 at 00:58:21 UTC, Marc wrote: for example: enum A { a = -10, b = -11, c = -12, d = -13, e = -34} enum int countOfA = coutOfFields(A); // 5 fields https://dlang.org/spec/traits.html#allMembers enum A { a = -10, b = -11, c = -12, d = -13, e = -34} enum int

DMD test suite assertion failure in test_cdvecfill.d

2017-11-20 Thread Michael V. Franklin via Digitalmars-d-learn
I'm getting this error when I try to run the DMD test suite. cd dmd make -C test -f Makefile ... runnable/test_cdvecfill.d -O (-mcpu=avx -mcpu=avx2) Test failed. The logged output: ../src/dmd -conf= -m64 -Irunnable -O -odtest_results/runnable -oftest_results/runnable/test_cdvecfill_0

Re: writeln, alias this and dynamic arrays.

2017-11-16 Thread Michael V. Franklin via Digitalmars-d-learn
On Friday, 17 November 2017 at 02:13:54 UTC, matthewh wrote: [...] as is it produces: [1, 2, 3, 4, 5, 6, 7, 8] [] I expected it to produce: [1, 2, 3, 4, 5, 6, 7, 8] [1, 2, 3, 4, 5, 6, 7, 8] And with the toString override included it does. Why does the version without the toString override

Re: writeln, alias this and dynamic arrays.

2017-11-16 Thread Michael V. Franklin via Digitalmars-d-learn
On Friday, 17 November 2017 at 02:16:35 UTC, Michael V. Franklin wrote: On Friday, 17 November 2017 at 02:13:54 UTC, matthewh wrote: And with the toString override included it does. Why does the version without the toString override output an empty array? I think that is due to this bug:

Re: writeln, alias this and dynamic arrays.

2017-11-16 Thread Michael V. Franklin via Digitalmars-d-learn
On Friday, 17 November 2017 at 02:13:54 UTC, matthewh wrote: And with the toString override included it does. Why does the version without the toString override output an empty array? I think that is due to this bug: https://issues.dlang.org/show_bug.cgi?id=13189 It's actually on my todo

Re: Conditional compilation of array of structs initializer

2017-11-09 Thread Michael V. Franklin via Digitalmars-d-learn
On Friday, 10 November 2017 at 06:22:51 UTC, Tony wrote: Doing a port of some C code that has an #ifdef in the middle of an initialization for an array of structs. I am getting a compile error trying to get equivalent behavior with "static if" or "version". Is there a way to achieve this other

Re: Compiler magic for preventing memory access re-ordering _by the compiler_ (keywords: memory model, compiler optimisations, memory order)

2017-11-05 Thread Michael V. Franklin via Digitalmars-d-learn
On Monday, 6 November 2017 at 05:54:00 UTC, Michael V. Franklin wrote: On Monday, 6 November 2017 at 03:40:23 UTC, Cecil Ward wrote: Is there a magic visible sign (or even one needed) in the D language that tells D _compilers_ not to move certain types of memory load / store operations

Re: Compiler magic for preventing memory access re-ordering _by the compiler_ (keywords: memory model, compiler optimisations, memory order)

2017-11-05 Thread Michael V. Franklin via Digitalmars-d-learn
On Monday, 6 November 2017 at 03:40:23 UTC, Cecil Ward wrote: Is there a magic visible sign (or even one needed) in the D language that tells D _compilers_ not to move certain types of memory load / store operations forwards or backwards relative to other operations when optimising the code

Re: Any book recommendation for writing a compiler?

2017-11-01 Thread Michael V. Franklin via Digitalmars-d-learn
On Wednesday, 1 November 2017 at 20:53:44 UTC, Dr. Assembly wrote: Hey guys, if I were to get into dmd's source code to play a little bit (just for fun, no commercial use at all), which books/resources do you recommend to start out? I found this to be quite helpful:

Re: Temporary objects as function parameters or when-is-this-shit-going-to-end?

2017-10-15 Thread Michael V. Franklin via Digitalmars-d-learn
On Monday, 16 October 2017 at 03:29:03 UTC, Michael V. Franklin wrote: My experience says that BountySource almost doesn't help. It works if the bounty is worth someone sacrificing their free time to do the work. For example, I'd attempt fixing the bug if the bounty were greater than

Re: Temporary objects as function parameters or when-is-this-shit-going-to-end?

2017-10-15 Thread Michael V. Franklin via Digitalmars-d-learn
On Friday, 13 October 2017 at 11:54:38 UTC, Jack Applegame wrote: On Friday, 13 October 2017 at 11:21:48 UTC, Biotronic wrote: BountySource[2] lets you do basically exactly that. My experience says that BountySource almost doesn't help. It works if the bounty is worth someone sacrificing