On Sunday, 22 January 2017 at 03:42:21 UTC, Ali Çehreli wrote:
On 01/21/2017 07:22 PM, Basile B. wrote:
[...]
Wow! Thanks.
I know about 'alias this' but this (pun!) is new to me. TIL
indeed and WAT (four exclamation marks is right in this
case. :o) )
import std.stdio;
struct S {
On 01/21/2017 07:22 PM, Basile B. wrote:
On Sunday, 22 January 2017 at 00:31:38 UTC, Ali Çehreli wrote:
On 01/21/2017 03:36 PM, Ali Çehreli wrote:
> Change the signature and it works without copies:
>
> this(const(this)) {
> // ...
> }
Ugh... :( It's not a post-blit. Then what
On Sunday, 22 January 2017 at 00:31:38 UTC, Ali Çehreli wrote:
On 01/21/2017 03:36 PM, Ali Çehreli wrote:
> Change the signature and it works without copies:
>
> this(const(this)) {
> // ...
> }
Ugh... :( It's not a post-blit. Then what is it?
Ali
This is a __ctor that takes
On 01/21/2017 03:36 PM, Ali Çehreli wrote:
> Change the signature and it works without copies:
>
> this(const(this)) {
> // ...
> }
Ugh... :( It's not a post-blit. Then what is it?
Ali
On 01/21/2017 03:19 PM, Ali Çehreli wrote:
this(this) {
TIL! Change the signature and it works without copies:
this(const(this)) {
// ...
}
How did I miss this for so long?
Ali
Simplified:
import std.stdio;
struct Widget {
private int[] array;
this(uint length) {
array = new int[length];
writefln("ctor called : %s", array.ptr);
}
this(this) {
writef( "this(this) called: %s", array.ptr );
array = array.dup;
wr
Compile this and see, (it's crazy!):
import std.stdio;
struct Widget {
private int[] array;
this(uint length) {
array = new int[length];
}
this(this) {
writeln( "this(this) called" );
array = array.dup;
}
On Saturday, 21 January 2017 at 18:38:22 UTC, Nestor wrote:
That would be cool for greater portability.
The hard part in porting to a new platform is rarely the code
generation - gdc and ldc have diverse backends already (indeed,
they tend to work for D as well as C there). But you still have
On Saturday, 21 January 2017 at 18:38:22 UTC, Nestor wrote:
Hi friends,
Is there a way to "compile" d code to C, similar to what nim
does?
That would be cool for greater portability.
No, and this is actually a terrible idea. See
https://forum.dlang.org/post/n1vbos$11ov$1...@digitalmars.com
On Saturday, 21 January 2017 at 18:38:22 UTC, Nestor wrote:
Hi friends,
Is there a way to "compile" d code to C, similar to what nim
does?
That would be cool for greater portability.
The wiki says there was a dmd fork that attempted this 5 years
ago, don't know how far he got:
https://wi
Hi friends,
Is there a way to "compile" d code to C, similar to what nim does?
That would be cool for greater portability.
Thank you both!
Le 21/01/2017 à 13:24, Jerry a écrit :
On Friday, 20 January 2017 at 22:47:17 UTC, Xavier Bigand wrote:
Hi,
I am writing some code with opengl commands that I want to check in
debug, so I am using the function checkgl (from glamour lib).
The issue is that checkgl throw exception and can't be @
I'm not sure if it's what happening in this case but, in code
as simple as this, function calls can sometimes be the
bottleneck. You should see how compiling with/without -O
affects performance, and adding `pragma(inline)` to funcB.
When compiled with -inline, the profiler does not report the
On Saturday, 21 January 2017 at 12:33:57 UTC, albert-j wrote:
Now I dmd -profile it and look at the performance of funcA with
d-profile-viewer. Inside funcA, only 20% of time is spend in
funcB, but the rest 80% is self-time of funcA. How is it
possible, when funcB has three times the calculatio
Let's say I want to create an array of random numbers and do some
operations on them:
void main() {
import std.random;
//Generate array of random numbers
int arrSize = 1;
double[] arr = new double[](arrSize);
foreach (i; 0..arrSize)
arr[i] = uniform01();
On Friday, 20 January 2017 at 22:47:17 UTC, Xavier Bigand wrote:
Hi,
I am writing some code with opengl commands that I want to
check in debug, so I am using the function checkgl (from
glamour lib).
The issue is that checkgl throw exception and can't be @nogc, I
had try to use std.experimen
On Thursday, 19 January 2017 at 08:06:04 UTC, ketmar wrote:
alias is not a macro, it is alias to *symbol*. only symbol, not
any arbitrary expression.
In fact, it can nowadays be. You just have to mark it so, with a
lambda:
void main()
{ import std.stdio;
auto myArray = [2, 3, 5, 6];
18 matches
Mail list logo