Re: Problem with take(map())

2011-07-30 Thread Daniel Murphy
The problem is the parameter p is not being heap allocated. I'm fairly sure it's already in bugzilla, something about failing to detect escaping references with alias parameters. "bearophile" wrote in message news:j0vhod$t87$1...@digitalmars.com... > D2 code: > > > import std.stdio, std.algor

Re: Using templates to declare function prototypes

2011-07-30 Thread Daniel Murphy
It is documented! http://www.digitalmars.com/d/1.0/attribute.html#linkage http://www.digitalmars.com/d/2.0/attribute.html#linkage "Heinz" wrote in message news:j12itk$2o99$1...@digitalmars.com... > Thanks, extern(System) seems to do the job under windows at least, i hope > it > switch to extern

Re: Using templates to declare function prototypes

2011-07-30 Thread Heinz
Thanks, extern(System) seems to do the job under windows at least, i hope it switch to extern(C) for other systems, can't test it right now. The System version works even with the old DMD 1.030. If this defined version is that old then why it is not documented yet with newer releases? Thank you

Re: Using templates to declare function prototypes

2011-07-30 Thread Daniel Murphy
Use extern(System)? "Heinz" wrote in message news:j12hkk$2mcd$1...@digitalmars.com... > Hello D community!!! > > I'm porting the NVIDIA CUDA headers to D. The CUDA platform runs on > multiple > OS, so functions prototypes (in the D way) are declared as > "extern(Windows) > ..." for MS Windows

Using templates to declare function prototypes

2011-07-30 Thread Heinz
Hello D community!!! I'm porting the NVIDIA CUDA headers to D. The CUDA platform runs on multiple OS, so functions prototypes (in the D way) are declared as "extern(Windows) ..." for MS Windows and "extern(C) ..." for other OS'es. The thing is that there's no "alias extern(X) myextern;" in D to b

Re: Ubuntu installation not working

2011-07-30 Thread Andrej Mitrovic
There was another thread I made, but I forgot to file the bug: http://d.puremagic.com/issues/show_bug.cgi?id=6413

Re: Versioned extern?

2011-07-30 Thread Nick Sabalausky
"Aleksandar Ruzicic" wrote in message news:mailman.1954.1311949602.14074.digitalmars-d-le...@puremagic.com... > >Ouh, haven't read that you don't want code to be mixed-in.. In that case.. I dunno :) It's not that I didn't want to, it's just that I was wondering if there was a better way. Fortu

Re: Scope of lambdas and closures

2011-07-30 Thread Rolv Seehuus
== Quote from Rolv Seehuus (rolv.seeh...@gmail.com)'s article > == Quote from Daniel Murphy (yebbl...@nospamgmail.com)'s article > > "Rolv Seehuus" wrote in message > > news:j04qff$i4s$1...@digitalmars.com... > > > Is there a related/same reason why this don't compile? > > > > > > unittest { > > >

Re: Scope of lambdas and closures

2011-07-30 Thread Rolv Seehuus
== Quote from Daniel Murphy (yebbl...@nospamgmail.com)'s article > "Rolv Seehuus" wrote in message > news:j04qff$i4s$1...@digitalmars.com... > > Is there a related/same reason why this don't compile? > > > > unittest { > > static void stuff(){} > > static void function()[string] functions = [ "s

Re: Generate array of random values

2011-07-30 Thread Andrej Mitrovic
Yeah I really like Python's list comprehensions. That's something I'll always miss in D.

Re: Generate array of random values

2011-07-30 Thread bearophile
Andrej Mitrovic: > void main() > { > auto arr2 = array(map!( (int){ return uniform(0, 1024); })(iota(0, > 1024))); > } > > Is there a simpler way to do get an array of random values? If you want a single expression you are allowed to write a bit shorter code: auto arr2 = array(map!((int){ r

Generate array of random values

2011-07-30 Thread Andrej Mitrovic
I'm currently using this: import std.algorithm; import std.array; import std.random; import std.range; void main() { auto arr2 = array(map!( (int){ return uniform(0, 1024); })(iota(0, 1024))); } Is there a simpler way to do get an array of random values?

Re: DMD's kernel32.lib missing symbols?

2011-07-30 Thread torhu
On 30.07.2011 11:43, simendsjo wrote: On 29.07.2011 22:06, Simon wrote: On 29/07/2011 19:27, simendsjo wrote: On 29.07.2011 19:13, Simon wrote: On 29/07/2011 11:14, simendsjo wrote: Not sure how I can search for symbols in the library, but it seems the library is missing functions. I've

Re: DMD's kernel32.lib missing symbols?

2011-07-30 Thread simendsjo
On 29.07.2011 22:06, Simon wrote: On 29/07/2011 19:27, simendsjo wrote: On 29.07.2011 19:13, Simon wrote: On 29/07/2011 11:14, simendsjo wrote: Not sure how I can search for symbols in the library, but it seems the library is missing functions. I've tried using coffimplib on kernel32.lib from