Re: Using a delegate stored as a member of a destroyed struct?

2014-01-27 Thread Nicolas Sicard
On Monday, 27 January 2014 at 02:27:08 UTC, Steven Schveighoffer wrote: On Sun, 26 Jan 2014 18:41:00 -0500, Nicolas Sicard dran...@gmail.com wrote: Running a piece of code that can be reduced to: --- import std.stdio; void main() { import std.range; foreach(item; iota(0,

Creating an array of C structs

2014-01-27 Thread Colin Grogan
Why wont the following code compile? import std.stdio; void main() { myStruct[] mystructs = { {1, 1.1f}, {2, 2.2f} }; } extern(C){ struct myStruct{ int x; float y; } } It fails with the (unhelpful imo) error message: source/app.d(7): Error: a

Re: Creating an array of C structs

2014-01-27 Thread Namespace
On Monday, 27 January 2014 at 09:06:17 UTC, Colin Grogan wrote: Why wont the following code compile? import std.stdio; void main() { myStruct[] mystructs = { {1, 1.1f}, {2, 2.2f} }; } extern(C){ struct myStruct{ int x; float y; } } It fails

Memory leak in hello world

2014-01-27 Thread Thejaswi Puthraya
I have a simple Hello World program (file named tmp.d) written in D import std.stdio; void main() { printf(Hello World\n); } I successfully compiled the above program with the DMD64 D compiler v2.064 on linux x86_64 (libc 2.18 just in case required). But valgrind reports memory leaks

Re: Creating an array of C structs

2014-01-27 Thread Colin Grogan
On Monday, 27 January 2014 at 09:34:04 UTC, Namespace wrote: On Monday, 27 January 2014 at 09:06:17 UTC, Colin Grogan wrote: Why wont the following code compile? import std.stdio; void main() { myStruct[] mystructs = { {1, 1.1f}, {2, 2.2f} }; } extern(C){ struct

Re: Creating an array of C structs

2014-01-27 Thread Stanislav Blinov
On Monday, 27 January 2014 at 10:13:08 UTC, Colin Grogan wrote: Arrays are enclosed in [] ;) I'm an idiot. Can I delete this thread to save further embarrassment? :) No! Evenryone will see this! :E~

Re: Creating an array of C structs

2014-01-27 Thread Francesco Cattoglio
On Monday, 27 January 2014 at 10:13:08 UTC, Colin Grogan wrote: On Monday, 27 January 2014 at 09:34:04 UTC, Namespace wrote: Arrays are enclosed in [] ;) I'm an idiot. Can I delete this thread to save further embarrassment? :) HA-HA! (read it with Nelson voice, ofc)

Re: Completly static Laurent's polynomials

2014-01-27 Thread Meta
On Monday, 27 January 2014 at 11:15:36 UTC, matovitch wrote: Hello ! Yesterday, I started a project to implement completly static Laurent's polynomials (i.e. polynomials formed by z^n and z^-n monomials). I thought I could represent these polynomials with an immutable range of

Re: Completly static Laurent's polynomials

2014-01-27 Thread matovitch
On Monday, 27 January 2014 at 13:18:06 UTC, Meta wrote: On Monday, 27 January 2014 at 11:15:36 UTC, matovitch wrote: Hello ! Yesterday, I started a project to implement completly static Laurent's polynomials (i.e. polynomials formed by z^n and z^-n monomials). I thought I could represent

Re: Completly static Laurent's polynomials

2014-01-27 Thread matovitch
I just clone phobos so we could agree about the line numbers : /usr/include/dmd/phobos/std/conv.d(3889): Error: memcpy cannot be interpreted at compile time, because it has no available source code /usr/include/dmd/phobos/std/range.d(4769):called from here: emplace(addr,

Re: Creating an array of C structs

2014-01-27 Thread Francesco Cattoglio
On Monday, 27 January 2014 at 13:08:28 UTC, Colin Grogan wrote: In my defense, I believe C initializes arrays with the curly brackets Can I keep making excuses? Yes you can... And don't worry, I mess up initialization too. Lots of time. Especially when I tried initializing an array of

Re: ODBC SQLBindParameter for string array

2014-01-27 Thread Regan Heath
On Sat, 25 Jan 2014 11:05:11 -, Andre an...@s-e-a-p.de wrote: // CREATE TABLE demo(name VARCHAR(1)) // INSERT INTO demo (name) VALUES (?) string[] stringArr = [A,B,C]; SQLSetStmtAttr(hStmt, SQL_ATTR_PARAMSET_SIZE, cast(SQLPOINTER) stringArr.length, 0); SQLSetStmtAttr(hStmt,

Re: Using a delegate stored as a member of a destroyed struct?

2014-01-27 Thread Steven Schveighoffer
On Mon, 27 Jan 2014 03:17:51 -0500, Nicolas Sicard dran...@gmail.com wrote: Actually I used a struct because the code is more complex, and it builds an array of delegates, which are returned from global functions, like: --- struct Transformer { real delegate(real)[] funs;

std.copy (to multiple output ranges),

2014-01-27 Thread Robert Schadek
I'm searching the docs for something similar to: copy(someInputRange, firstOutputRange, secondOutputRange, ); I know how to write it by hand, but I'm suspecting that something like this is already in phobos. And secondly, is there some function that gives me a forward range to some input

Re: std.copy (to multiple output ranges),

2014-01-27 Thread Ilya Yaroshenko
On Monday, 27 January 2014 at 17:26:35 UTC, Robert Schadek wrote: I'm searching the docs for something similar to: copy(someInputRange, firstOutputRange, secondOutputRange, ); I know how to write it by hand, but I'm suspecting that something like this is already in phobos. Hi, I think

Re: std.copy (to multiple output ranges),

2014-01-27 Thread Justin Whear
On Mon, 27 Jan 2014 15:44:43 +0100, Robert Schadek wrote: I'm searching the docs for something similar to: copy(someInputRange, firstOutputRange, secondOutputRange, ); I know how to write it by hand, but I'm suspecting that something like this is already in phobos. And secondly, is

A small question default values in tmplate-functions

2014-01-27 Thread Uplink_Coder
Hello, Suppose I have the following function auto veryStableAPI(string parameter,VaraiadicParams...)() { // do something very slow and stable; } auto experimentalReplacement(string parameter,VaraidcParams ...)() { // do the same thing very fast and dangerous } is the following

Re: Using a delegate stored as a member of a destroyed struct?

2014-01-27 Thread Nicolas Sicard
On Monday, 27 January 2014 at 14:47:21 UTC, Steven Schveighoffer wrote: On Mon, 27 Jan 2014 03:17:51 -0500, Nicolas Sicard dran...@gmail.com wrote: Actually I used a struct because the code is more complex, and it builds an array of delegates, which are returned from global functions, like:

Re: Why CTFE is context-sensitive?

2014-01-27 Thread Brad Roberts
On 1/27/14 10:40 AM, Pierre Talbot wrote: On Monday, 27 January 2014 at 01:39:47 UTC, Simen Kjærås wrote: On 2014-01-26 09:59, Pierre Talbot wrote: Hi, I was wondering why CTFE is context sensitive, why don't we check every expressions and run the CTFE if it applies? Mostly because it's not

Re: std.json tree navigation help

2014-01-27 Thread cal
On Monday, 27 January 2014 at 06:51:57 UTC, dennis wrote: I am having trouble understanding how to navigate the tree returned by std.json. I am new to D programming, I have tried reading the std.json source code but I am still stumped. I usually end up doing something like this when dealing

Linux dll struct class etc

2014-01-27 Thread Mineko
I can't remember whether or not I've asked this.. But either way, is it possible to export a class or a struct or something like you do with a windows dll with a linux shared library (dll)?

Re: std.json tree navigation help

2014-01-27 Thread Dan Killebrew
Check out the json module in vibe.d. Maybe copy it into your own application (since it can't be used as a library, yet). http://vibed.org/api/vibe.data.json/ https://github.com/rejectedsoftware/vibe.d

Re: mixin template

2014-01-27 Thread Dan Killebrew
Found this: http://forum.dlang.org/thread/ntuysfcivhbphnhnn...@forum.dlang.org#post-mailman.1409.1339356130.24740.digitalmars-d-learn:40puremagic.com If what Jonathan says is true, then http://dlang.org/template-mixin.html should be updated: s/mixin template/template/