Re: C++ const expression are not that const after all

2015-04-28 Thread Luc Bourhis via Digitalmars-d
On Tuesday, 28 April 2015 at 02:48:09 UTC, H. S. Teoh wrote: On Tue, Apr 28, 2015 at 02:24:01AM +, deadalnix via Digitalmars-d wrote: http://b.atch.se/posts/non-constant-constant-expressions/ Whoa. This is gonna give me nightmares tonight... that is absolutely insane. The author of

Re: Vectorization examples

2015-04-24 Thread Luc Bourhis via Digitalmars-d
On Monday, 20 April 2015 at 11:15:48 UTC, finalpatch wrote: On Monday, 20 April 2015 at 11:01:28 UTC, Panke wrote: Aren't unaligned loads as fast as aligned loads on modern x86? No that's not true. On modern x86 processors using unaligned loading instructions on aligned data does not incur

Re: math libraries

2015-02-14 Thread Luc Bourhis via Digitalmars-d
Thank you very much Ilya for this comprehensive and clear answer.

math libraries

2015-02-12 Thread Luc Bourhis via Digitalmars-d
What is the difference between (i) core.math, (ii) std.math, (iii) core.stdc.math and (iv) core.stdc.tgmath? (iv) falls back on (iii) as far as I can tell. (i) and (ii) seem to emit the same old x87 instructions, like fsin e.g., even for double and float. What's the difference? So that

Re: Proposal : aggregated dlang git repository

2015-02-11 Thread Luc Bourhis via Digitalmars-d
On Tuesday, 10 February 2015 at 22:12:41 UTC, Vladimir Panteleev wrote: On Tuesday, 10 February 2015 at 21:45:49 UTC, Luc Bourhis wrote: On Monday, 9 February 2015 at 06:33:42 UTC, Dicebot wrote: Idea is to create an aggregated repository as part of D-Programming-Language organization which

Re: Proposal : aggregated dlang git repository

2015-02-10 Thread Luc Bourhis via Digitalmars-d
On Monday, 9 February 2015 at 06:33:42 UTC, Dicebot wrote: Idea is to create an aggregated repository as part of D-Programming-Language organization which will include other existing ones as a submodules Imho, git subtree would be a better idea

std.stdio and copying

2015-01-22 Thread Luc Bourhis via Digitalmars-d
If s is the instance of some struct S, write(s) will first copy s. Not only this can be very inefficient but it won't even compile if S features @disable this(this). The same goes for all the other functions, including format(s=%s, s) One is then force to manually insert s.toString(). Not

Re: [unittest] constness

2015-01-20 Thread Luc Bourhis via Digitalmars-d
On Monday, 19 January 2015 at 16:12:59 UTC, Luc Bourhis wrote: Thanks everybody for your help! Just one point I forgot to mention: the compiler chokes on static assert(!__traits(compiles, xc[0] = 1.0)); with: found '=' when expecting ')' following template argument list But static

Documenting the use of mixing templates

2015-01-20 Thread Luc Bourhis via Digitalmars-d
ddox does not seem to pick up on mixin MySuperDuperFeatures!(). So the only way at the moment seems to put a note in the class or the struct top documentation. Or am I missing something?

mixin template and overloading

2015-01-20 Thread Luc Bourhis via Digitalmars-d
Consider: ~ % dmd -v|head -n 1 DMD64 D Compiler v2.066-devel ~% cat mixin_template_pb.d mixin template Foo(T) { void bar() {} } struct FooBar { mixin Foo!int; void bar(ulong d)() {} } void check() { FooBar o; o.bar(); } ~% dmd -c mixin_template_pb.d mixin_template_pb.d(12): Error:

Re: [unittest] constness

2015-01-19 Thread Luc Bourhis via Digitalmars-d
Thanks everybody for your help!

[unittest] constness

2015-01-16 Thread Luc Bourhis via Digitalmars-d
Testing constness implementation is easy: const Foo a; a.non_const_method(); // compilation fails but how would I catch that in a unittest?

Re: [std.traits] Detect complex numbers

2015-01-14 Thread Luc Bourhis via Digitalmars-d
It doesn't answer your question as such, but you should take a look at: http://dlang.org/phobos/std_complex.html The planned obsolescence of cdouble and consort is another issue I wanted to raise actually but better do it in a dedicated thread.

Re: [std.traits] Detect complex numbers

2015-01-14 Thread Luc Bourhis via Digitalmars-d
I forgot to mention the obvious: I simply parroted the code in std.traits!

[std.traits] Detect complex numbers

2015-01-14 Thread Luc Bourhis via Digitalmars-d
There is isFloatingPointType!T to find out whether type T is one of the floating point types but I could not find anything equivalent for complex numbers (cdouble, cfloat, creal) in Phobos 2.066 (which I installed with MacPorts for the record). Am I missing something? My goal was to detect

Re: Alignment of dynamic arrays

2015-01-09 Thread Luc Bourhis via Digitalmars-d
Keeping alignment when slicing is easy since it matches the size of the xmm registers: one has to partition the array by blocks of 2 doubles, 4 floats, etc. For AVX, the ideal alignment is on 32-byte boundaries but the really bad performance hit happens only when an unaligned access crosses a

Alignment of dynamic arrays

2015-01-08 Thread Luc Bourhis via Digitalmars-d
With auto a = new double[1000], is there any guarantee that a.ptr is aligned on a 16-byte boundary? Indeed I would like to use core.simd and this alignment is paramount for efficient loading from memory to SSE2 registers. On MacOS X and 64-bit Linux, it looks true for dmd. Looking at the

Re: Alignment of dynamic arrays

2015-01-08 Thread Luc Bourhis via Digitalmars-d
On Friday, 9 January 2015 at 00:23:47 UTC, bearophile wrote: Luc Bourhis: With auto a = new double[1000], is there any guarantee that a.ptr is aligned on a 16-byte boundary? Arrays are aligned on a 16-byte. Good news! But if you slice them, this alignment can be broken. Yes, of

Mathematical formulae in documentation / Mathjax

2014-12-04 Thread Luc Bourhis via Digitalmars-d
Hi, MathJax is a Javascript trick that can nicely typeset mathematical equations written in TeX, on-the-fly, in any HTML document. Enabling it is easily done by adding some script .../script in the head, which I managed to do by overriding DDOC. However, if I have a piece of code like ///