Re: Pointer to std.container.Array data for C library

2015-08-28 Thread Oleg via Digitalmars-d-learn
On Friday, 28 August 2015 at 18:46:23 UTC, Oleg wrote: I found solution. I call length instead of reserve. It calls ensureInitialized and everything works fine. By default, Array won't initialize store. Oh, reserve calls it too. My mistake. I found the problem, that's because I passed an empt

Re: Pointer to std.container.Array data for C library

2015-08-28 Thread Oleg via Digitalmars-d-learn
On Friday, 28 August 2015 at 18:40:33 UTC, John Colvin wrote: On Friday, 28 August 2015 at 18:31:00 UTC, Oleg wrote: On Friday, 28 August 2015 at 18:21:04 UTC, John Colvin wrote: On Friday, 28 August 2015 at 17:45:21 UTC, Oleg wrote: Hello! Is it possible to get pointer to a data in std.conta

Re: Pointer to std.container.Array data for C library

2015-08-28 Thread Oleg via Digitalmars-d-learn
On Friday, 28 August 2015 at 18:21:04 UTC, John Colvin wrote: On Friday, 28 August 2015 at 17:45:21 UTC, Oleg wrote: Hello! Is it possible to get pointer to a data in std.container.Array like .ptr from an array? I need to pass a pointer to some C function (from DerelictGL3 binding) and avoid G

Pointer to std.container.Array data for C library

2015-08-28 Thread Oleg via Digitalmars-d-learn
Hello! Is it possible to get pointer to a data in std.container.Array like .ptr from an array? I need to pass a pointer to some C function (from DerelictGL3 binding) and avoid GC allocation. Thank you!

Re: Set null as function array parameter

2015-01-12 Thread Oleg via Digitalmars-d-learn
On Monday, 12 January 2015 at 16:44:42 UTC, ketmar via Digitalmars-d-learn wrote: nope, it means exactly what is written there. except that dynamic array is represented by struct like this: struct { void *dataptr; size_t itemCount; } this is what D calls "dynamic array", and this i

Re: Set null as function array parameter

2015-01-12 Thread Oleg via Digitalmars-d-learn
On Monday, 12 January 2015 at 15:59:43 UTC, Adam D. Ruppe wrote: Why are you using ref? Take that off and you can pass any array, including null, with ease. Because dynamic arrays are passed by value to functions. Will it make another copy of array, if I'll pass array by value? Looks like it

Set null as function array parameter

2015-01-12 Thread Oleg via Digitalmars-d-learn
Hello. How can I call a function with null as parameter, which I don't want to set. For example: void foo(ref int[] param1) {} I can't call this function like: foo(null); Is it possible to set default value for an array parameter or pass null/empty array? I can create empty array and pass it, bu

Contract programming

2014-12-17 Thread Oleg via Digitalmars-d-learn
Is this behavior normal or it's bug? [code] import std.stdio; class A { float func( float x ) in { assert( x > 0 ); stderr.writeln( "A.func in block" ); } body { stderr.writeln( "A.func body block" ); return x / 3; } } class B : A {

Re: UDA and mixins

2014-12-16 Thread Oleg via Digitalmars-d-learn
struct FooPasted(Args...){} class A { mixin foo; void func1() @mark { ... } void func2( int x, string a ) @mark { ... } } must change to: class A { void func1() @mark { ... } void func2( int x, string a ) @mark { ... } FooPasted!() func1_mark; FooPasted!(int,string) func2_mark; }

UDA and mixins

2014-12-16 Thread Oleg via Digitalmars-d-learn
I want to write mixin template, what past and/or change some code in class. Mixin must get all functions with user defined attribute and past fields for example. It should looks like this struct FooPasted(Args...){} class A { mixin foo; void func1() @mark { ... } void func2( int x, string a )

Re: release building problem

2014-12-04 Thread Oleg via Digitalmars-d-learn
renaming struct from 'Client' to 'MClient' resolve question

Re: release building problem

2014-12-03 Thread Oleg via Digitalmars-d-learn
the same result of building release or profile

release building problem

2014-12-03 Thread Oleg via Digitalmars-d-learn
When I build my program with release flag I get an errors, in debug build all works .dub/build/application-profile-linux.posix-x86_64-dmd-AD20DEA65FEE410217932549C1D262EF/ftree.o: In function `_D3des4flow5event5Event27__T6__ctorTS6client6ClientZ6__ctorMFNcmKxS6client6ClientZS3des4flow5event5Ev

const class

2014-11-26 Thread Oleg via Digitalmars-d-learn
Hello. I can't find siple way to realization this behavior: [code] class A { A parent; void someFunc() const { } void parentCall() const { const(A) cur = this; while( cur ) { cur.someFunc(); cur = cur.parent; } } } [/code] error: cannot modify const

Re: SQLite3

2014-05-07 Thread Oleg via Digitalmars-d-learn
On Wednesday, 7 May 2014 at 06:21:10 UTC, Jack wrote: void* NotUsedAtAll, // Null variable int argc, // What? char** results, // Results? char** columnNames //Column Names? You can read about this agruments on http://www.sqlite.org/c3ref/exec.html

newbie question about dub

2014-05-06 Thread Oleg via Digitalmars-d-learn
Hello. I'm developing library and want to add an examples to the same project. If I understand corecly, DUB allows to build a dependencies from another folder and use them to build a program. I've tried two ways - subConfigurations and subPackages. For example, there is subConfigurations confi