source\app.d(37,10): Error: function `app.main.match!((some) =>
print(some), (none) => print("none")).match` requires a
dual-context, which is not yet supported by LDC
I was playing with my home made "sumtypes".
The code below works fine in dmd, but in ldc it triggers that
error.
x.match!(so
On Friday, 13 September 2019 at 04:23:47 UTC, Paul Backus wrote:
On Friday, 13 September 2019 at 02:49:33 UTC, SrMordred wrote:
[...]
"Dual context" is the compiler feature that allows you to pass
delegates as template arguments to member functions. For a long
time, limitations in the fronte
https://garden.dlang.io/
On Sunday, 20 October 2019 at 08:41:19 UTC, TodNaz wrote:
Hello! I can’t understand ... My dialogue code is not working
as it should! He must, if the texture does not exceed the
maximum value, add a character, otherwise go to a new line
until the text ends. But he constantly makes the transitio
On Tuesday, 22 October 2019 at 22:14:02 UTC, OiseuKodeur wrote:
Hello, i am having a problem with dub build with this project
https://github.com/OiseauKodeur/cervelet/tree/master/source
when i try to compile everything go well but when i click to
run the .exe it give my an error missing msvcr1
//-betterC
import core.stdc.stdio;
import std.algorithm;
void main(){
printf( "%d\n",startsWith("a","b") );
}
//Fails to compile with betterC, dmd/ldc2 last versions.
Any reason for not work with betterC or should i file the issue ?
(Find this on a bindbc lib, so i think that it may have wo
The issue is that strings aren't input ranges in betterC [1],
due to autodecoding.
Normally you'd work around this using std.utf.byCodeUnit, but
that's currently broken, because std.utf attempts to import
core.exception.UnicodeException from druntime at module scope
[2], causing any betterC p
I got undefined symbol: __chkstk when using some external .o
sources ( compile with clang ) + betterC flag.
I thought that __chkstk was present on ntdll.lib, so i added
manually as a lib, but still didn´t work.
How can i solve this? (it must be another lib that D includes
since it works with
Someone knows how to strip unused symbols on final binary using
ldc on windows ?
i found this about this topic:
https://forum.dlang.org/post/yvmnkvzgoxhcfavja...@forum.dlang.org
that uses --gc-sections and --version-script but this options are
not avaliable in windows lld-link
On Saturday, 21 March 2020 at 15:53:53 UTC, kinke wrote:
On Saturday, 21 March 2020 at 01:54:00 UTC, SrMordred wrote:
Someone knows how to strip unused symbols on final binary
using ldc on windows ?
i found this about this topic:
https://forum.dlang.org/post/yvmnkvzgoxhcfavja...@forum.dlang.or
On Saturday, 21 March 2020 at 18:01:55 UTC, kinke wrote:
On Saturday, 21 March 2020 at 17:33:21 UTC, SrMordred wrote:
Hmm, ok, my question is in fact relate to this kind of thing:
https://godbolt.org/z/NGjyyx
Why int example.add(int, int): its still on the binary when
all u need is alredy opti
On Friday, 24 April 2020 at 22:24:34 UTC, Marcone wrote:
I don't want to use lambda.
I don't want create variable.
What is the best way to refer to itself when obtaining
Substring withou using lambda and without create variable?
example:
writeln("Hello Word!"[x.indexOf(" "), $]);
Maybe u
struct T
{
int x;
@property ref X(){ return x; }
@property X(int v)
{
x = v;
}
}
T t;
t.X += 10;
The setter 'x = v' are not executed because i´m returning the
reference of x.
And without the 'ref' the compiler complains because 'x' is not a
lvalue.
Any solution to
On Thursday, 10 May 2018 at 19:41:41 UTC, Dlang User wrote:
On 5/10/2018 1:43 PM, SrMordred wrote:
[...]
I am relatively new to D and I was under the impression that
that was a limitation of @property functions.
But, re-reading the language reference, it gave this example
(it returns somet
After all this time I saw this:
writeln = iota = 5;
what??
I never saw that before!
This is interesting, there is something useful that i can do with
this kind of call?
Right, so this should´n be working I think.
struct SomeStruct
{
void foo(int);
}
SomeStruct s;
s.foo = 10;
I thought that only with @property this will work.
"%s %s".writefln = ("foo".tuple = "bar").expand;
lol
int[] a;
int[] b;
()@nogc {
foreach(v ; chain( a,b ) ) printf("%d\n", v);
}();
//Ok, everything fine;
char[] a;
char[] b;
()@nogc {
foreach(v ; chain( a,b ) ) printf("%c\n", v);
}();
//Error: @nogc delegate onlineapp.main.__lambda1 cannot call
non-@nogc function std.range.chain!(char[]
On Friday, 25 May 2018 at 00:04:10 UTC, Adam D. Ruppe wrote:
On Thursday, 24 May 2018 at 23:55:24 UTC, SrMordred wrote:
//Error: @nogc delegate onlineapp.main.__lambda1 cannot call
non-@nogc function std.range.chain!(char[],
char[]).chain.Result.front
Why?
phobos automatically decodes utf8
Because arrays of char and wchar are treated as ranges of dchar.
That part that I didnt know, thanks! :)
a => { return 2*a; }
/\ \ /
|| \ /
||\ /
|| \ /
|| \ /
This is \ /
function \ This is definition of delegate
definition \
so you have a function that returns delegate.
```
it's like
a => a => 2*a;
or
(a){ return () { return
this idiom for creating static array used to work, but they are
failing now.
What changed and whats the alternative?
(from
https://p0nce.github.io/d-idioms/#@nogc-Array-Literals:-Breaking-the-Limits)
T[n] s(T, size_t n)(auto ref T[n] array) pure nothrow @nogc @safe
{
return array;
}
void
On Tuesday, 12 June 2018 at 15:39:10 UTC, Steven Schveighoffer
wrote:
Essentially what you had originally was a memory corruption bug
(yes, even before the deprecation happened).
Oops , that bad.
On Tuesday, 12 June 2018 at 16:27:50 UTC, SrMordred wrote:
On Tuesday, 12 June 2018 at 15:39:10 UTC, Steven Schveighoffer
wrote:
Essentially what you had originally was a memory corruption
bug (yes, even before the deprecation happened).
Oops , that bad.
Well, not anymore ;)
Is possible to make a Custom Struct String work for D string
constraints?
eg:
struct MyString
{
char[] arr;
alias arr this;
}
void getString( char[] str ){}
MyString().split(";"); //oops, type mismatch
getString( MyString() ); //fine, implicit conversion
isSomeString!(char[]).writel
On Tuesday, 26 June 2018 at 22:16:28 UTC, Jonathan M Davis wrote:
If what you're asking is whether it's possible for a template
constraint that uses something like isSomeString will ever
match a user-defined type, then the answer is no.
Thats exactly what I wanted xD.
My idea was that if you
On Saturday, 30 June 2018 at 10:48:49 UTC, Suliman wrote:
Correct me if I am wrong, but I have read news that dmd now can
be used without C++ Build Tools.
I trying to build simple project. And getting Error:
Warning: no Visual C++ installation detected
OPTLINK (R) for Win32 Release 8.00.17
Co
On Friday, 6 July 2018 at 10:55:47 UTC, Rainer Schuetze wrote:
On 06/07/2018 05:48, SrMordred wrote:
[...]
The problem is that the Digital Mars linker is called but the
Microsoft linker is run, because they share the same name
link.exe. For dmd/x64/32mscoff or LDC in general the latter is
On Friday, 6 July 2018 at 19:36:05 UTC, 0xEAB wrote:
On Friday, 6 July 2018 at 03:48:04 UTC, SrMordred wrote:
Well I just installed the VS 2017 to try the ldc and get
(maybe) the same error.
You didn't forget to install the Windows SDK with it, did you?
Yep I forgot xD
It fixed the PATHs but
Delete everything, installed everything again, the installation
failed to set the proper PATH to MS link.exe, so i put it by hand
and now get:
fatal error LNK1104: cannot open file 'libcmt.lib'
Frustrating.
Well, since its VS 2017 installer, eventually I hit all the
components needed to install it properly. Now its working.
Thanks 0xEAB for the tip about the Windows SDK too :)
Most C++ game related projects uses GLM as they default
math/vector lib (even if not using opengl).
In D we have (that I found):
gfm.math - https://github.com/d-gamedev-team/gfm
dlib.math - https://github.com/gecko0307/dlib
Gl3n - https://github.com/Dav1dde/gl3n
But i'm not sure which to
https://run.dlang.io/is/TOTsL4
On Thursday, 6 September 2018 at 07:37:11 UTC, Simen Kjærås wrote:
On Wednesday, 5 September 2018 at 22:35:16 UTC, SrMordred wrote:
https://run.dlang.io/is/TOTsL4
Yup, that's a bug. Reduced example:
struct S {
int*[1] arr;
}
import std.traits : hasAliasing;
static assert(hasAliasing!S);
On Friday, 14 September 2018 at 19:44:37 UTC, berni wrote:
a) I've got an int[] which contains only 0 und 1. And I want to
end with a string, containing 0 and 1. So [1,1,0,1,0,1] should
become "110101". Of course I can do this with a loop and ~. But
I think it should be doable with functional s
Its possible to use setjmp/longjmp on windows?
Or, to be straight to my problem: its possible to continue
execution after a SIGSEGV(or any other failure/signal) with
betterC and windows?
On Tuesday, 18 September 2018 at 00:12:35 UTC, Diederik de Groot
wrote:
On Monday, 17 September 2018 at 23:44:41 UTC, SrMordred wrote:
[...]
You can use core.stdc.signal
nothrow @nogc @system sigfn_t signal(SIGSEGV, sigfn_t func)
To catch the signal
With a handler signature of:
enum void funct
On Tuesday, 18 September 2018 at 03:09:18 UTC, Mike Parker wrote:
On Tuesday, 18 September 2018 at 00:24:23 UTC, SrMordred wrote:
Yes, i'm using signal(SIGSEGV, sigfn_t func), it catches
correctly, but end the execution after.
I find the alternatives of setjmp/longjmp and sigaction, but
none
longjmp is crashing so may be related to the struct declaration.
On Tuesday, 18 September 2018 at 20:01:48 UTC, SrMordred wrote:
longjmp is crashing so may be related to the struct declaration.
Well just found a thread of the same problem, just that in my
case with 64x crashes too.
https://forum.dlang.org/post/mmxwhdypncaeikknl...@forum.dlang.org
On Wednesday, 19 September 2018 at 11:12:41 UTC, Diederik de
Groot wrote:
On Wednesday, 19 September 2018 at 11:06:23 UTC, Diederik de
Groot wrote:
On Tuesday, 18 September 2018 at 19:45:18 UTC, SrMordred wrote:
Only the exact size of the jmp_buf is important (not the
details about the conten
Ok, after a better look at the sources I finally got it:
setjmp is a macro.
the true function signature is "int _setjmp(jmp_buf, void*)"
the void* is the current function address which in mingw sources
are capture by "__builtin_frame_address(0)".
And I did´t look yet to see if Dlang have an e
size_t[2] a;
size_t[2] b;
auto x = a[] & b[]; //array operation without destination
memory not allowed
size_t[2] y = a[] & b[]; // fine
On Tuesday, 15 January 2019 at 17:52:35 UTC, Machine Code wrote:
https://github.com/dlang/dmd/blob/master/src/dmd/compiler.d#L75
https://dlang.org/spec/lex.html#token_strings
:)
On Tuesday, 15 January 2019 at 11:14:54 UTC, John Burton wrote:
As an example let's say I have a type 'Window' that represents
a win32 window. I'd like to be able to construct an instance of
the type with some optional parameters that default to some
reasonable settings and create the underlyin
On Thursday, 17 January 2019 at 12:11:02 UTC, Matheus wrote:
foo(alias x){}
foo("a");
foo(1);
'x' will be string one time and integer another? Or there is
something that I'm missing.
Matheus.
Yes, but there is a mistake there:
alias is part of the template:
foo(alias x)(){} //note extra
On ubuntu:
void test(size_t l)
{
char* a;
a[0 .. l] = a[0 .. l];
}
extern(C) void main(){
test(0);
}
ldc2 source/app.d //compiles
dub --compiler=ldc2 //app.d:4: error: undefined reference to
'_d_array_slice_copy'
oh, and:
DUB version 1.13.0, built on Feb 17 2019
LDC - the LLVM D compiler (1.14.0):
based on DMD v2.084.1 and LLVM 7.0.1
On Monday, 18 February 2019 at 19:14:42 UTC, SrMordred wrote:
oh, and:
DUB version 1.13.0, built on Feb 17 2019
LDC - the LLVM D compiler (1.14.0):
based on DMD v2.084.1 and LLVM 7.0.1
Sorry, both give the same error, the problem is related to
-betterC flag (which i forgot to add on first c
On Monday, 18 February 2019 at 23:40:20 UTC, kinke wrote:
On Monday, 18 February 2019 at 19:10:50 UTC, SrMordred wrote:
dub --compiler=ldc2 //app.d:4: error: undefined reference to
'_d_array_slice_copy'
Dub has nothing to do with it, it's the -betterC flag, and LDC
expecting that druntime fun
import std.traits;
import std.stdio;
struct Test(T)
{
this(T)( auto ref T value )
{
writeln( TemplateOf!(typeof(value)).stringof);
writeln( __traits(isSame, TemplateOf!(typeof(value)), Test) );
}
}
void main(){
auto value = Test!in
On Tuesday, 19 February 2019 at 23:03:37 UTC, Paul Backus wrote:
On Tuesday, 19 February 2019 at 22:43:25 UTC, SrMordred wrote:
import std.traits;
import std.stdio;
struct Test(T)
{
this(T)( auto ref T value )
{
writeln( TemplateOf!(typeof(value)).stringof);
wr
On Tuesday, 19 March 2019 at 19:50:15 UTC, Craig wrote:
Take a look at my lib, its a simple hot-reload external dll lib:
https://github.com/SrMordred/reloaded
I did´nt use it extensively, but its simple enough to be tweaked
at your own need :)
I´m following this link to build d+sdl2+emscripten on web:
https://theartofmachinery.com/2018/12/20/emscripten_d.html
And, i´m was able to compile but i get the warnings
warning: Linking two modules of different data layouts / target
triples
even when I compile using x86. So i´m not sure if this
On Thursday, 16 May 2019 at 19:27:15 UTC, Dukc wrote:
On Thursday, 16 May 2019 at 18:23:12 UTC, SrMordred wrote:
[...]
Nice will take a look on this two, thanks :)
Its possible to call copyctor manually without calling dtor?
ex, what i did before:
struct T{ ~this(){ writeln("DTOR"); } this(this){
writeln("POSTBLIT"); } }
T a;
T b;
memcpy(&a,&b,T.sizeof);
a.__postblit;
/*
output:
POSTBLIT
DTOR
DTOR
*/
With copy ctors, not sure what to do.
struct T{
On Saturday, 1 June 2019 at 19:10:36 UTC, Paul Backus wrote:
On Saturday, 1 June 2019 at 02:27:36 UTC, SrMordred wrote:
void main() {
T a;
T b;
a.__ctor(b);
}
https://run.dlang.io/is/NeioBs
Thanks!
The most obvious way i didn´t think :P
import std.traits;
struct T { this(ref return scope T other){} }
pragma(msg, hasElaborateCopyConstructor!T); //false
On Saturday, 1 June 2019 at 21:39:33 UTC, SImen Kjærås wrote:
On Saturday, 1 June 2019 at 21:05:32 UTC, SrMordred wrote:
hasElaborateCopyConstructor checks if the type defines a
postblit[0].
Yes, I know this.
But since dmd 2.086 we have copy ctors:
https://dlang.org/changelog/2.086.0.html#c
On Sunday, 2 June 2019 at 04:02:08 UTC, Paul Backus wrote:
On Saturday, 1 June 2019 at 23:29:08 UTC, SrMordred wrote:
On Saturday, 1 June 2019 at 21:39:33 UTC, SImen Kjærås wrote:
On Saturday, 1 June 2019 at 21:05:32 UTC, SrMordred wrote:
Haven't tested it extensively, so use at your own risk
I never notice this before, but i tried to put a basic hello
world from vibe.d (like the one that are in the dlang front page
examples now), into the most basic instance on google cloud (with
600mb of RAM) and the compilation returned
"Killed
dmd failed with exit code 137."
So I look at the RA
There is a way to get the full function(or any other structure)
declaration with traits? Or I will have to mount it with
std.traits functions?
eg.
void add(int x, int y){}
GetFullFunctionDeclaration!add; //return "void add(int x, int y)"
On Tuesday, 18 July 2017 at 13:53:11 UTC, Ivan Kazmenko wrote:
On Tuesday, 18 July 2017 at 13:35:49 UTC, SrMordred wrote:
There is a way to get the full function(or any other
structure) declaration with traits? Or I will have to mount it
with std.traits functions?
eg.
void add(int x, int y){}
On Monday, 24 July 2017 at 19:45:03 UTC, dark777 wrote:
pessoal eu tenho umas classes java e estava portando para D e
para usar as importaçoes criei os modules nescessarios todos
estao dentro da mesma pasta porem ao fazer:
$rdmd principal
ele retorna o seguinte erro:
principal.d(18): Error:
On Monday, 24 July 2017 at 20:14:23 UTC, SrMordred wrote:
On Monday, 24 July 2017 at 19:45:03 UTC, dark777 wrote:
pessoal eu tenho umas classes java e estava portando para D e
para usar as importaçoes criei os modules nescessarios todos
estao dentro da mesma pasta porem ao fazer:
$rdmd princi
//D-CODE
struct MyStruct{
int id;
this(int id){
writeln("ctor");
}
~this(){
writeln("dtor");
}
}
MyStruct* obj;
void push(T)(auto ref T value){
obj[0] = value;
}
void main()
{
obj = cast(MyStruct*)malloc( MyStruct.sizeof );
push(MyStruct(1));
}
OU
On Thursday, 27 July 2017 at 20:28:47 UTC, Moritz Maxeiner wrote:
On Thursday, 27 July 2017 at 19:19:27 UTC, SrMordred wrote:
//D-CODE
struct MyStruct{
int id;
this(int id){
writeln("ctor");
}
~this(){
writeln("dtor");
}
}
MyStruct* obj;
void push(T)(auto ref
On Friday, 28 July 2017 at 15:49:42 UTC, Moritz Maxeiner wrote:
[...]
Nice, a bit more clear now, thank you!
On Friday, 28 July 2017 at 16:25:01 UTC, Adam D. Ruppe wrote:
On Thursday, 27 July 2017 at 19:19:27 UTC, SrMordred wrote:
"auto ref means ref for lvalues, value for rvalues."
Iep, my confusion was there. My mind is still wrapped around the
rvalue references and move semantics of c++
On Ubuntu:
//dub.json
{
"name": "d_betterc",
"dflags" : ["-betterC"]
}
//source/app.d
import std.stdio;
extern (C) int main(int argc, char** argv) {
int[] x;
writeln(x);
return 0;
}
//cmd
dub run --config=application --arch=x86_64 --build=debug
--compiler=dmd
//or
dmd -bette
On Wednesday, 30 August 2017 at 22:45:27 UTC, Adam D. Ruppe wrote:
On Wednesday, 30 August 2017 at 22:18:07 UTC, SrMordred wrote:
DMD64 D Compiler v2.075.1
-betterC as described recently is not yet released.
https://dlang.org/changelog/2.076.0_pre.html
is where it gets the new behavior, and
On Wednesday, 30 August 2017 at 23:12:07 UTC, SrMordred wrote:
On Wednesday, 30 August 2017 at 22:45:27 UTC, Adam D. Ruppe
wrote:
On Wednesday, 30 August 2017 at 22:18:07 UTC, SrMordred wrote:
DMD64 D Compiler v2.075.1
-betterC as described recently is not yet released.
https://dlang.org/cha
Im using SDL2 with derelict, on ubuntu.
Last DMD.
When using spawn or new Thread like :
spawn( (){
while(true){
Thread.sleep(500.msecs);
});
the program open two SDL windows.
Whats going on , and how to prevent this ?
On Saturday, 2 September 2017 at 03:47:24 UTC, Adam D. Ruppe
wrote:
On Saturday, 2 September 2017 at 03:41:47 UTC, SrMordred wrote:
Whats going on , and how to prevent this ?
Are you using a static this anywhere?
Hm, right.
I was constructing the window there.
Forgot that static this will ex
struct Test{
@property int value(){
writeln("property value : ", _value);
return _value;
}
int _value;
Test opIndex( string index )
{
writeln( "opIndex : index : ", index );
return this;
}
Test opIndexAssign(int value, string index )
Should I report this as a bug?
I tried a C++ equivalent code and it execute in the expected
order.
I used to have a guide to creating "Derelictified" bindings for
an older version. I should write one up for the current version.
+1
On Monday, 18 September 2017 at 15:14:20 UTC, Moritz Maxeiner
wrote:
On Monday, 18 September 2017 at 15:11:34 UTC, Moritz Maxeiner
wrote:
gets rewritten to
---
t.opIndex("b").opIndexAssign(t["a"].value, "c");
---
Sorry, forgot one level of rewriting:
---
t.opIndex("b").opIndexAssign(t.opInd
void main() {
auto s = S();
s["b", "c"] = s["a"];
}
Prints
a
["b", "c"]
Ali
I thought about this too, thanks!
When using Parameters!T there are no difference between ref int
and int for eg.
I know there is ParameterStorageClassTuple!T but it didt solve my
problem:
I want to transform any ref Type parameters in Type* like:
staticMap!( ref2ptr, Parameters!MyFunc ); //(ref int, int)
But then again re
writeln( "a.b.c".splitter('.').dropBack(1) ); //compiles ok
writeln( "a.b.c".splitter(".").dropBack(1) );
//error:
Error: template std.range.dropBack cannot deduce function from
argument types !()(Result, int), candidates are:
(...)
Hm.. can someone explain whats going on?
For "a.b.c"splitter(x), Range r is a string, r.front is a
char. The template can only be instantiated if the predicate
function is valid. The predicate function is "a == b". Since
r.front is a char, then s must be a type that can be compared
with '=='. A string and char cannot be compared with
In order to know where to split, it really has to do it from
the front. If it starts from the back, you won't necessarily
split in the same places as when iterating from the front, and
that would violate how bidirectional ranges are supposed to
work (the elements should be the same - just in re
Maybe i´m tired already, but whats wrong here:
pragma(msg, __traits( compiles, mixin("int x") ) );
//output: false
On Wednesday, 25 October 2017 at 19:12:02 UTC, SrMordred wrote:
Maybe i´m tired already, but whats wrong here:
pragma(msg, __traits( compiles, mixin("int x") ) );
//output: false
Or the original case I found:
struct T{}
pragma(msg, __traits( compiles, T() ) ); //true
pragma(msg, __traits( co
On Wednesday, 25 October 2017 at 19:25:01 UTC, Adam D. Ruppe
wrote:
On Wednesday, 25 October 2017 at 19:12:02 UTC, SrMordred wrote:
Maybe i´m tired already, but whats wrong here:
pragma(msg, __traits( compiles, mixin("int x") ) );
You are missing a ;
The mixin must compile as a full thing in
The semicolon there indicates it is a complete statement that
does nothing, and that's no error.
so why this line resolves to false?
void F(){}
pragma(msg, __traits( compiles, mixin("F();") ) );//false
On Wednesday, 25 October 2017 at 20:04:47 UTC, Adam D. Ruppe
wrote:
On Wednesday, 25 October 2017 at 19:50:31 UTC, SrMordred wrote:
so why this line resolves to false?
Because it is illegal to put a statement or declaration inside
__traits(compiles). sorry, I should have said that before...
immutable int[] arr = [1,2,3,4,5];
auto t = spawn({ receive( (immutable int[] v) => writeln(v) );});
t.send(arr);
whats the problem here?
On Friday, 24 November 2017 at 12:05:16 UTC, SrMordred wrote:
immutable int[] arr = [1,2,3,4,5];
auto t = spawn({ receive( (immutable int[] v) => writeln(v)
);});
t.send(arr);
whats the problem here?
Nothing prints out
On Friday, 24 November 2017 at 12:36:42 UTC, Daniel Kozak wrote:
Should print something like this:
std.concurrency.OwnerTerminated@std/concurrency.d(223): Owner
terminated
Yes, it was, I was aware of this and put some sleep after that
too.
(immutable (int)[] v)
OK that parenteshis was th
Nice, thank you!
I´m experimenting with threads and related recently.
(i´m just started so may be some terrrible mistakes here)
With this base work:
foreach(i ; 0 .. SIZE)
{
results[i] = values1[i] * values2[i];
}
and then with this 3 others methods: parallel, spawn and Threads.
this was my results:
_base
On Monday, 19 February 2018 at 05:49:54 UTC, Nicholas Wilson
wrote:
As SIZE=1024*1024 (i.e. not much, possibly well within L2 cache
for 32bit) it may be that dealing with the concurrency overhead
adds a significant amount of overhead.
That 'concurrency overhead' is what i´m not getting.
Since
On Monday, 19 February 2018 at 05:54:53 UTC, Dmitry Olshansky
wrote:
The operation is trivial and dataset is rather small. In such
cases SIMD with eg array ops is the way to go:
result[] = values[] * values2[];
Yes, absolutely right :)
I make a simple example to understand why the threads are
string x = "123";
auto c = x.ptr;
c++;
writeln(c[-1]); // 1
writeln(c[-1..0]); //BOOM Range violation
Can I do this / Bug / some mistake ?
But with a slice negative indexes are never allowed, even on a
pointer.
youd have to do
(c-1)[0 .. 1];
Nice!
Thank you both!
In D Slice article it says "You can even use negative indexes!"
so I thought
that the [-1..x] should work too :)
On Thursday, 22 February 2018 at 02:41:30 UTC, Steven
Schveighoffer wrote:
Hah! I never thought of doing a slice with negative indexes ;)
Maybe is my past of python:
arr[-3:] to get the last 3 elements for eg.
:)
I was playing around my ES and different ways of doing it with D.
I end up with a performance test of alias func vs ranges vs
opApply.
code here:
https://dpaste.dzfl.pl/a2eff240552f
Results on my machine win 10 x64, compiling with:
dub run --build=release --arch=x86 --compiler=ldc2
(unable to
On Monday, 19 June 2017 at 19:06:57 UTC, ag0aep6g wrote:
For me, alias_fun and op_apply are very close. If anything,
alias_fun seems to be slightly faster.
Typical output (ldc2 -release -O3):
Avoiding bounds checking makes it faster for me (but is unsafe
of course):
I took a deeper look
100 matches
Mail list logo