I'm puzzled by the way destroy works when passed a pointer to a
struct, observe:
--code.d--
int i;
struct C
{
this(ref int i)
{
++i;
ii = &i;
}
~this()
{
--(*i
On 02/25/2017 12:17 AM, Radu wrote:
> destroy(cc) -> does c = C.init
> destroy(*cc); -> calls the C dtor
>
> Is this by design? If so - how can I destroy and get the dtor called
> without dereferencing the pointer?
It's by design because setting a pointer to null can be considered as
destroying
On Saturday, 25 February 2017 at 08:36:02 UTC, Ali Çehreli wrote:
On 02/25/2017 12:17 AM, Radu wrote:
> destroy(cc) -> does c = C.init
> destroy(*cc); -> calls the C dtor
>
> Is this by design? If so - how can I destroy and get the dtor
called
> without dereferencing the pointer?
It's by design
I have noticed that some numerical packages written in D use
pointer semantics heavily (not referring to packages that link to
C libraries). I am in the process of writing code for a numerical
computing library and would like to know whether there times when
addressing an array using pointers c
data pulverizer wrote:
I have noticed that some numerical packages written in D use pointer
semantics heavily (not referring to packages that link to C
libraries). I am in the process of writing code for a numerical
computing library and would like to know whether there times when
addressing
On Saturday, 25 February 2017 at 11:15:53 UTC, ketmar wrote:
data pulverizer wrote:
I have noticed that some numerical packages written in D use
pointer semantics heavily (not referring to packages that link
to C libraries). I am in the process of writing code for a
numerical computing librar
On Saturday, 25 February 2017 at 10:44:07 UTC, Radu wrote:
On Saturday, 25 February 2017 at 08:36:02 UTC, Ali Çehreli
wrote:
On 02/25/2017 12:17 AM, Radu wrote:
> destroy(cc) -> does c = C.init
> destroy(*cc); -> calls the C dtor
>
> Is this by design? If so - how can I destroy and get the dtor
On Saturday, 25 February 2017 at 13:14:24 UTC, Moritz Maxeiner
wrote:
---
struct A {}
auto a = cast (A*) malloc(A.sizeof); // Allocate
emplace(a, 42); // Construct
destroy(a); // Destruct
free(a); // Deallocate
---
Sorr
On Saturday, 25 February 2017 at 11:06:28 UTC, data pulverizer
wrote:
I have noticed that some numerical packages written in D use
pointer semantics heavily (not referring to packages that link
to C libraries). I am in the process of writing code for a
numerical computing library and would like
I am trying to create an array which has a user defined size.
However the following program is not compiling:
import std.stdio;
void main(){
write("Enter your array size: ");
int n;
readf(" %s", &n);
int[n] arr; //<-Error: variable input cannot be read at
compile time
writ
On 26/02/2017 3:31 AM, helxi wrote:
I am trying to create an array which has a user defined size. However
the following program is not compiling:
import std.stdio;
void main(){
write("Enter your array size: ");
int n;
readf(" %s", &n);
int[n] arr; //<-Error: variable input canno
On Saturday, 25 February 2017 at 14:34:31 UTC, rikki cattermole
wrote:
On 26/02/2017 3:31 AM, helxi wrote:
I am trying to create an array which has a user defined size.
However
the following program is not compiling:
import std.stdio;
void main(){
write("Enter your array size: ");
int
On Saturday, 25 February 2017 at 13:14:24 UTC, Moritz Maxeiner
wrote:
On Saturday, 25 February 2017 at 10:44:07 UTC, Radu wrote:
On Saturday, 25 February 2017 at 08:36:02 UTC, Ali Çehreli
wrote:
On 02/25/2017 12:17 AM, Radu wrote:
> destroy(cc) -> does c = C.init
> destroy(*cc); -> calls the C
On Saturday, 25 February 2017 at 13:18:21 UTC, Moritz Maxeiner
wrote:
On Saturday, 25 February 2017 at 13:14:24 UTC, Moritz Maxeiner
wrote:
---
struct A {}
auto a = cast (A*) malloc(A.sizeof); // Allocate
emplace(a, 42); // Construct
destroy(a); //
On Saturday, 25 February 2017 at 15:21:56 UTC, Radu wrote:
The correct way of doing it using deref would to look like:
struct A { int i; }
auto a = cast (A*) malloc(A.sizeof); // Allocate
emplace(a, 42); // Construct
destroy(*a); // Destruct A
free
On Saturday, 25 February 2017 at 15:13:27 UTC, Radu wrote:
Here is sample on how destroy fails with a fwd decl error:
struct A
{
B b;
C c;
}
struct B
{
Wrap!A val;
}
struct C
{
Wrap!A val;
}
struct Wrap(T)
{
this(bool b)
{
t = cast(T*) malloc(T.sizeof);
}
Hello,
I have a method for range:
struct Range {
immutable(ubyte[]) _buffer;
size_t _pos;
@property void popFront() pure @safe {
enforce(_pos < _buffer.length, "popFront from empty
buffer");
_pos++;
}
}
I'd like to have @nogc here, but I can't beca
On 2017-02-24 19:10, houdoux09 wrote:
The problem is that I can not retrieve the variables from the parent class.
Cast the value to the type of the base class and run it through the same
function. You can have a look at the Orange serialization library [1].
[1] https://github.com/jacob-carl
On Saturday, 25 February 2017 at 19:59:29 UTC, ikod wrote:
Hello,
I have a method for range:
struct Range {
immutable(ubyte[]) _buffer;
size_t _pos;
@property void popFront() pure @safe {
enforce(_pos < _buffer.length, "popFront from empty
buffer");
_p
On 2017-02-24 23:44, XavierAP wrote:
And second question, is DWT the de facto standard for creating GUIs? Or
are there good competitors.
There's no de factor library for creating GUIs in D. If you want a
native look and feel, DWT is a good option. If you want the application
to look the same
On Saturday, 25 February 2017 at 20:02:56 UTC, ikod wrote:
On Saturday, 25 February 2017 at 19:59:29 UTC, ikod wrote:
Hello,
I have a method for range:
struct Range {
immutable(ubyte[]) _buffer;
size_t _pos;
@property void popFront() pure @safe {
enforce(_pos <
On Saturday, 25 February 2017 at 20:40:26 UTC, Eugene Wissner
wrote:
it builds and doesn't throw if I compile with:
dmd -release
though it causes a segfault, what is probably a dmd bug.
No, that's by design. assert(0) compiles to a segfault
instruction with -release.
A wrapper that unifies t
On Saturday, 25 February 2017 at 20:49:51 UTC, Adam D. Ruppe
wrote:
On Saturday, 25 February 2017 at 20:40:26 UTC, Eugene Wissner
wrote:
it builds and doesn't throw if I compile with:
dmd -release
though it causes a segfault, what is probably a dmd bug.
No, that's by design. assert(0) compiles
On Saturday, 25 February 2017 at 20:49:51 UTC, Adam D. Ruppe
wrote:
A wrapper that unifies these 4 steps like enforce is pretty
easy to implement.
yeah easy to use exception in @nogc as long as the catch knows
to free it too.
Alas, not my case. Exception can be catched not in my code.
On Saturday, 25 February 2017 at 20:03:17 UTC, Jacob Carlborg
wrote:
There's no de factor library for creating GUIs in D. If you
want a native look and feel, DWT is a good option. If you want
the application to look the same on all platforms, there might
be other better suited alternatives.
I
On Saturday, 25 February 2017 at 19:59:29 UTC, ikod wrote:
Hello,
I have a method for range:
struct Range {
immutable(ubyte[]) _buffer;
size_t _pos;
@property void popFront() pure @safe {
enforce(_pos < _buffer.length, "popFront from empty
buffer");
_p
On Saturday, 25 February 2017 at 21:26:32 UTC, XavierAP wrote:
It's not GUI projects that I would plan to work on, just
something easy with basic functionality that I can use for my
own utilities or test clients for libraries. And if there's
anything with any kind of designer support (in which
Hello! I've encroutered intresting tool of DMD. It is dump of AST
in JSON format (dmd -X main.d). But I it contains only
declaration of methods, templates and structs. It doesn't contain
statements like a variables or nested functions inside function's
body.
Is it possible to make dump with s
On 26/02/2017 4:01 PM, ANtlord wrote:
Hello! I've encroutered intresting tool of DMD. It is dump of AST in
JSON format (dmd -X main.d). But I it contains only declaration of
methods, templates and structs. It doesn't contain statements like a
variables or nested functions inside function's body.
29 matches
Mail list logo