Re: How to detect if an array if dynamic or static

2016-02-24 Thread Ali Çehreli via Digitalmars-d-learn
On 02/24/2016 08:44 PM, mahdi wrote: > On Wednesday, 24 February 2016 at 22:38:04 UTC, Adam D. Ruppe wrote: >> On Wednesday, 24 February 2016 at 21:48:14 UTC, mahdi wrote: >>> How can we detect is `array` is static (fixed size) or dynamic, >>> inside the function body? >> >> `array` there is alway

Re: Dynamic pitch shift

2016-02-24 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Wednesday, 24 February 2016 at 17:52:39 UTC, Guillaume Piolat wrote: Though it isn't fantastic aliasing-wise on the last octave, I should try something than power-of-2s next time I need it. Why would it help to not use 2^n sized tables? I guess you could compute everything at 88khz and deci

Re: tell if __traits(allMembers, ... ) is an enum (not manifest constant)

2016-02-24 Thread Nicholas Wilson via Digitalmars-d-learn
On Thursday, 25 February 2016 at 04:50:14 UTC, Nicholas Wilson wrote: On Thursday, 25 February 2016 at 04:32:24 UTC, Adam D. Ruppe wrote: On Thursday, 25 February 2016 at 04:25:25 UTC, Nicholas Wilson wrote: foreach(m; __traits(allMembers, ...) { static if(is(m== enum)) } That's close bu

Re: tell if __traits(allMembers, ... ) is an enum (not manifest constant)

2016-02-24 Thread Nicholas Wilson via Digitalmars-d-learn
On Thursday, 25 February 2016 at 04:32:24 UTC, Adam D. Ruppe wrote: On Thursday, 25 February 2016 at 04:25:25 UTC, Nicholas Wilson wrote: foreach(m; __traits(allMembers, ...) { static if(is(m== enum)) } That's close but not quite there... try static if(is(typeof(__traits(getMember, Item,

Re: How to detect if an array if dynamic or static

2016-02-24 Thread mahdi via Digitalmars-d-learn
On Wednesday, 24 February 2016 at 22:38:04 UTC, Adam D. Ruppe wrote: On Wednesday, 24 February 2016 at 21:48:14 UTC, mahdi wrote: How can we detect is `array` is static (fixed size) or dynamic, inside the function body? `array` there is always dynamic because it is not of a fixed size type.

Re: tell if __traits(allMembers, ... ) is an enum (not manifest constant)

2016-02-24 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 25 February 2016 at 04:25:25 UTC, Nicholas Wilson wrote: foreach(m; __traits(allMembers, ...) { static if(is(m== enum)) } That's close but not quite there... try static if(is(typeof(__traits(getMember, Item, m)) == enum)) for member variables, or if you are looking at a type

tell if __traits(allMembers, ... ) is an enum (not manifest constant)

2016-02-24 Thread Nicholas Wilson via Digitalmars-d-learn
there is no __traits(isEnum, ...) I've tried foreach(m; __traits(allMembers, ...) { static if (__traits(compiles,EnumMembers!(m))) static if (EnumMembers!(m).length) static if(is(m== enum)) } I can detect static functions with __traits(isStaticFunction, ...)

Re: How to detect if an array if dynamic or static

2016-02-24 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 25 February 2016 at 01:31:17 UTC, Chris Wright wrote: When you get to GC-allocated stuff, there's no way to tell. The GC is easy, you can simply ask it: http://dpldocs.info/experimental-docs/core.memory.GC.addrOf.1.html "If p references memory not originally allocated by this gar

Re: How to detect if an array if dynamic or static

2016-02-24 Thread Chris Wright via Digitalmars-d-learn
On Wed, 24 Feb 2016 21:48:14 +, mahdi wrote: > Suppose we have a function like this: > > void diss(int[] array) ... > > How can we detect is `array` is static (fixed size) or dynamic, > inside the function body? Static arrays point to memory on the stack, inside an aggregate type on the he

Re: Simple performance question from a newcomer

2016-02-24 Thread Ali Çehreli via Digitalmars-d-learn
On 02/23/2016 12:12 PM, dextorious wrote: > Some languages > feature more accurate options separately, but never as the default, so > it did not occur to me to specifically check the documentation for > something like sum() (which is my fault, of course, no issues there). > Having the more accura

Re: How to detect if an array if dynamic or static

2016-02-24 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 24 February 2016 at 21:48:14 UTC, mahdi wrote: How can we detect is `array` is static (fixed size) or dynamic, inside the function body? `array` there is always dynamic because it is not of a fixed size type. Why do you want to know though?

Re: Installing DUB on OSX

2016-02-24 Thread Joel via Digitalmars-d-learn
On Wednesday, 24 February 2016 at 15:16:17 UTC, Jacob Carlborg wrote: On 2016-02-24 09:09, Joel wrote: I have OS X version 10.11.3 What about adding another path to $PATH? I don't know how though. Open or create ~/.bash_profile. Add the following: export PATH=:$PATH Replace with the path

How to detect if an array if dynamic or static

2016-02-24 Thread mahdi via Digitalmars-d-learn
Suppose we have a function like this: void diss(int[] array) ... How can we detect is `array` is static (fixed size) or dynamic, inside the function body?

Re: Simple performance question from a newcomer

2016-02-24 Thread jmh530 via Digitalmars-d-learn
On Wednesday, 24 February 2016 at 19:15:23 UTC, dextorious wrote: However, there doesn't seem to be any way to specify different dflags for different compilers There are examples like in the package format page "dflags-dmd": ["-vtls"], "sourceFiles-windows-x86_64-dmd": ["lib/win32/mylib.lib"]

Re: Simple performance question from a newcomer

2016-02-24 Thread dextorious via Digitalmars-d-learn
On Wednesday, 24 February 2016 at 03:33:14 UTC, Mike Parker wrote: On Tuesday, 23 February 2016 at 20:03:30 UTC, dextorious wrote: For instance, I am still not sure how to make it pass the -O5 switch to the LDC2 compiler and the impression I got from the documentation is that explicit manual sw

Re: Dynamic pitch shift

2016-02-24 Thread Guillaume Piolat via Digitalmars-d-learn
On Wednesday, 24 February 2016 at 14:02:49 UTC, Ola Fosheim Grøstad wrote: On Wednesday, 24 February 2016 at 10:33:56 UTC, Tanel Tagaväli wrote: Hello! I've been making some progress on the native D audio front: https://github.com/clinei/daud/tree/28ac042a16ae6785605a9a501b5f867c8f962055 It's

Re: Curl HTTP segfault

2016-02-24 Thread Kagamin via Digitalmars-d-learn
Oops, no, looks like you can't put HTTP in a class, because it works with GC and is ref counted.

Re: Curl HTTP segfault

2016-02-24 Thread Kagamin via Digitalmars-d-learn
http://pastebin.com/JfPtGTD8 ?

Curl HTTP segfault

2016-02-24 Thread skilion via Digitalmars-d-learn
Hello everyone, I have had this problem for a little while but I don't understand if I'm am not using correctly the HTTP struct, or if it is a library bug. Hear is my code: http://pastebin.com/Pgx7bqum I get a segfault on exit in the destructor calling std.net.curl.Curl.shutdown() Workarou

Re: vk.xml

2016-02-24 Thread Steven Schveighoffer via Digitalmars-d-learn
On 2/23/16 10:42 PM, Mike Parker wrote: On Wednesday, 24 February 2016 at 00:50:40 UTC, Nicholas Wilson wrote: AA's are nice in theory but the non-deterministic nature of their order of iteration is painful... An ordered map as the default AA implementation would be worse. Most use cases for

Re: Installing DUB on OSX

2016-02-24 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-02-24 09:09, Joel wrote: I have OS X version 10.11.3 What about adding another path to $PATH? I don't know how though. Open or create ~/.bash_profile. Add the following: export PATH=:$PATH Replace with the path you want to add. Close and save the file. Open a new window/tab in the

Re: Dynamic pitch shift

2016-02-24 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Wednesday, 24 February 2016 at 10:33:56 UTC, Tanel Tagaväli wrote: Hello! I've been making some progress on the native D audio front: https://github.com/clinei/daud/tree/28ac042a16ae6785605a9a501b5f867c8f962055 It's a continuous waveform generator, currently outputting a saw wave that chang

Re: Dynamic pitch shift

2016-02-24 Thread Nicholas Wilson via Digitalmars-d-learn
On Wednesday, 24 February 2016 at 10:33:56 UTC, Tanel Tagaväli wrote: Hello! I've been making some progress on the native D audio front: https://github.com/clinei/daud/tree/28ac042a16ae6785605a9a501b5f867c8f962055 It's a continuous waveform generator, currently outputting a saw wave that chang

Re: Dynamic pitch shift

2016-02-24 Thread Tanel Tagaväli via Digitalmars-d-learn
Sorry for the confusing state of the codebase. Only the saw wave generator is currently functional, the `saw` and `sine` functions are not used and should be left out of analysis. Also, audio output is only to ALSA.

Re: constant expression

2016-02-24 Thread Marc Schütz via Digitalmars-d-learn
On Tuesday, 23 February 2016 at 08:00:24 UTC, Nicholas Wilson wrote: Silly question. Why is this necessary? Due to a problem with the implementation, associative arrays currently can't be initialized statically. We hope it will eventually get fixed, but until then, you have to use module con

Dynamic pitch shift

2016-02-24 Thread Tanel Tagaväli via Digitalmars-d-learn
Hello! I've been making some progress on the native D audio front: https://github.com/clinei/daud/tree/28ac042a16ae6785605a9a501b5f867c8f962055 It's a continuous waveform generator, currently outputting a saw wave that changes pitch every 1K frames. I have a slight problem, however. Due to th

Re: Installing DUB on OSX

2016-02-24 Thread Joel via Digitalmars-d-learn
On Wednesday, 24 February 2016 at 07:35:40 UTC, Jacob Carlborg wrote: On 2016-02-24 07:49, Joel wrote: I get this: Joels-MacBook-Pro:bin joelcnz$ ln -s /usr/local/bin/dub /usr/bin ln: /usr/bin/dub: Operation not permitted Joels-MacBook-Pro:bin joelcnz$ If you have OS X 10.10.x or lower you