On Friday, 22 January 2016 at 06:53:29 UTC, mzf wrote:
D code:
auto arr = ["b1=1", "b=2","a1=1", "a=2"];
writeln(arr.sort());
output:["a1=1", "a=2", "b1=1", "b=2"]
C# code:
var arr = new string[]{ "b1=1", "b=2", "a1=1", "a=2" };
Array.Sort(arr);
output:["a=2","a1=1","b=2","b1=1"]
I don't
On Monday, 30 November 2015 at 20:27:51 UTC, Zardoz wrote:
On Monday, 30 November 2015 at 16:54:43 UTC, Sönke Ludwig wrote:
Am 24.11.2015 um 19:51 schrieb Zardoz:
Platform specifications are currently not supported for
dependencies due to the way the dependency resolver works.
However, it is
On Friday, 22 January 2016 at 01:53:53 UTC, Chris Wright wrote:
On Thu, 21 Jan 2016 21:52:06 +, Dibyendu Majumdar wrote:
Hi
I have C code where the struct has a trailing array member:
struct matrix {
int rows;
int cols;
double data[1];
};
D has bounds checking, which makes this
Should be possible. Why not?
On Friday, 22 January 2016 at 06:53:29 UTC, mzf wrote:
D code:
auto arr = ["b1=1", "b=2","a1=1", "a=2"];
writeln(arr.sort());
output:["a1=1", "a=2", "b1=1", "b=2"]
C# code:
var arr = new string[]{ "b1=1", "b=2", "a1=1", "a=2" };
Array.Sort(arr);
output:["a=2","a1=1","b=2","b1=1"]
auto a
i know the reason,C# have several compares methods.
String.Compare , String.CompareOrdinal
//now the output is same as the D code
Array.Sort(arr, string.CompareOrdinal);
On Friday, 22 January 2016 at 05:15:13 UTC, Mike Parker wrote:
On Thursday, 21 January 2016 at 23:06:55 UTC, Dibyendu Majumdar
wrote:
On Thursday, 21 January 2016 at 22:44:14 UTC, H. S. Teoh wrote:
Hi - I want to be sure that my code is not allocating memory
via the GC allocator; but when shipp
On Friday, 22 January 2016 at 02:16:14 UTC, H. S. Teoh wrote:
On Thu, Jan 21, 2016 at 04:50:12PM -0800, H. S. Teoh via
Digitalmars-d-learn wrote:
[...]
> > https://github.com/quickfur/fastcsv
[...]
Fixed some boundary condition crashes and reverted doubled
quote handling in unquoted fie
On Friday, 22 January 2016 at 08:39:06 UTC, Dibyendu Majumdar
wrote:
On Friday, 22 January 2016 at 01:53:53 UTC, Chris Wright wrote:
On Thu, 21 Jan 2016 21:52:06 +, Dibyendu Majumdar wrote:
Hi
I have C code where the struct has a trailing array member:
struct matrix {
int rows;
int
Hello. This is a minimal abstraction of a part of my program:
int func(string s)
{
static int [] i = [5, 6, 7];
return i[2];
}
template temp(string s) { enum temp = func(s); }
void main() { static assert(temp!"str" == 7); }
With the above code I get:
(4): Error: static variable i cannot
Why do you declare mutable constants?
Unsure where else to post this, since it feels like it would
intrude on the more serious discussions in the main D forum.
The new forum design is overall great, but it really doesn't work
well on mobile devices. Coupled with field padding the font is
simply too large. (This holds for the norma
On Friday, 22 January 2016 at 09:56:27 UTC, Shriramana Sharma
wrote:
In C/C++ the `static` here is used to avoid the array being
created every time the function is entered; in D too it does
the same thing, no? So if I have an array of constants in a
function that I need to be accessible to a
On Thursday, 21 January 2016 at 22:35:09 UTC, H. S. Teoh wrote:
Try this:
import std.meta;
template Stride(size_t stride, size_t offset, Args...)
if (stride > 0)
{
static if (offset >= Args.length)
alias Stride = AliasSeq!();
On Friday, 22 January 2016 at 10:12:31 UTC, JR wrote:
(This holds for the normal desktop too, to a certain subjective
extent.)
The feedback thread is
https://forum.dlang.org/post/bmjujolcjxcabshiw...@forum.dlang.org
I find padding and font size ok on desktop:
http://abload.de/img/tmpr1px5.png
On Friday, 22 January 2016 at 01:33:42 UTC, Darrell Gallion wrote:
void foo(A)()
if (!is (A == int)) {
pragma(msg, "int");
}
void foo(A)()
if (is (A == int[])) {
pragma(msg, "int[]");
}
void main() {
foo!(int)();
foo!(int[])();
}
===
source\app.d(15): Erro
On 22.01.2016 10:56, Shriramana Sharma wrote:
Do all values which need to
be readable at compile time need to be declared `immutable`?
Yes, `static immutable` or `enum`.
In C/C++ the `static` here is used to avoid the array being created every
time the function is entered; in D too it does th
On Friday, 22 January 2016 at 10:15:19 UTC, Mike Parker wrote:
A static variable is still a runtime variable. It's effectively
the same as declaring a variable outside of the function scope
at module scope, except that it's visible only in the current
scope and the function name gets mangled in
If you declare a JSONValue like this:
JSONValue json;
then:
assert(json.type() == JSON_TYPE.NULL);
Documentation at
https://dlang.org/phobos/std_json.html#.JSONValue.type.2 suggests
not to change type but to assign a new value instead.
My problem is: how can I assign an empty object like {
Let's say I have an array like this:
int[][][] array;
And I want to generate a linear int[] based on its data. Is there
a standard library method for achieving this, or must I iterate
over the array manually?
What I'm thinking of is something like this:
int[] onedim = std.array.collapse(arr
On Friday, 22 January 2016 at 11:53:11 UTC, Andrea Fontana wrote:
If you declare a JSONValue like this:
JSONValue json;
then:
assert(json.type() == JSON_TYPE.NULL);
Documentation at
https://dlang.org/phobos/std_json.html#.JSONValue.type.2
suggests not to change type but to assign a new valu
On 22.01.2016 06:59, Iakh wrote:
import std.stdio;
import core.simd;
int pmovmskb(inout byte16 v)
{
asm
{
movdqa XMM0, v;
pmovmskb EAX, XMM0;
ret;
}
}
void main()
{
byte16 a = [-1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
auto i = pmovmsk
On Friday, 22 January 2016 at 01:47:19 UTC, Rikki Cattermole
wrote:
Contrary to what it is called in the links, this is a
NewsGroup/Mailing list and not a forum. So no editing ability :)
I'll keep that in mind. Thanks :)
On Friday, 22 January 2016 at 01:49:58 UTC, anonymous wrote:
On 22.01.2016 01:49, W.J. wrote:
How can I identify those ranges, or, how can I tell if any
particular
range has value semantics ? I didn't read any of this in the
manual -
not that I could remember anyways.
Generally you shouldn't
On Friday, 22 January 2016 at 12:05:48 UTC, userABCabc123 wrote:
when you add the first key, the value will be set to
JSON_TYPE.OBJECT
import std.json;
void main(string[] args)
{
JSONValue json;
json["first"] = 0;
assert(json.type == JSON_TYPE.OBJECT);
}
That's right, b
On Friday, 22 January 2016 at 12:07:11 UTC, abad wrote:
Let's say I have an array like this:
int[][][] array;
And I want to generate a linear int[] based on its data. Is
there a standard library method for achieving this, or must I
iterate over the array manually?
What I'm thinking of is so
On Friday, 22 January 2016 at 11:23:56 UTC, Marc Schütz wrote:
On Friday, 22 January 2016 at 01:33:42 UTC, Darrell Gallion
wrote:
void foo(A)()
if (!is (A == int)) {
pragma(msg, "int");
}
void foo(A)()
if (is (A == int[])) {
pragma(msg, "int[]");
}
void main() {
foo!
On 1/17/16 1:27 AM, Jon D wrote:
My underlying question is how to compose functions taking functions as
arguments, while allowing the caller the flexibility to pass either a
function or delegate.
Simply declaring an argument as either a function or delegate seems to
prohibit the other. Overloadi
On Friday, 22 January 2016 at 12:18:53 UTC, anonymous wrote:
I don't know much about these things, but it seems to be the
`ret;`.
Right. This is an ordinary D function so the compiler generates
code to set up a stack for local variables. It looks like:
push ebp;
mov ebp, esp;
sub EBP, some_s
On Friday, 22 January 2016 at 12:07:11 UTC, abad wrote:
Let's say I have an array like this:
int[][][] array;
And I want to generate a linear int[] based on its data. Is
there a standard library method for achieving this, or must I
iterate over the array manually?
What I'm thinking of is so
Thanks to all who replied.
anonymous wrote:
>> Do all values which need to
>> be readable at compile time need to be declared `immutable`?
>
> Yes, `static immutable` or `enum`.
It would seem that in the case of arrays, the former is preferable to the
latter, as per the para above this header:
On 2016-01-22 01:31, Dibyendu Majumdar wrote:
I tried using htod but got errors as it could not handle the std C
header files (Visual C++). How do people work around this?
You could try DStep [1]. Although I'm not entirely sure if it works on
Windows. It uses libclang, so if Clang can handle t
On 22.01.2016 15:33, Shriramana Sharma wrote:
It would seem that in the case of arrays, the former is preferable to the
latter, as per the para above this header:
http://ddili.org/ders/d.en/const_and_immutable.html#ix_const_and_immutable.variable,
%20immutable
The link doesn't work for me, but
On Friday, 22 January 2016 at 13:03:52 UTC, Darrell Gallion wrote:
On Friday, 22 January 2016 at 11:23:56 UTC, Marc Schütz wrote:
On Friday, 22 January 2016 at 01:33:42 UTC, Darrell Gallion
wrote:
void foo(A)()
if (!is (A == int)) {
pragma(msg, "int");
}
void foo(A)()
if (i
On Friday, 22 January 2016 at 01:36:40 UTC, cym13 wrote:
On Friday, 22 January 2016 at 01:27:13 UTC, H. S. Teoh wrote:
And now that you mention this, RFC-4180 does not allow doubled
quotes in an unquoted field. I'll take that out of the code
(it improves performance :-D).
Right, re-reading th
What about the idea to allow discussion entries/threads to be
linked to dub package entries?
So they appear in DUB and in a additional section of this forum?
So vibe.d for example comes with his own forum that is good, but
a solution for all
would be nicer?
So coming back to my first questi
On Friday, 22 January 2016 at 04:43:52 UTC, Mike Parker wrote:
[snip]
Thanks again! Will review.
On Friday, 22 January 2016 at 16:07:59 UTC, Martin Tschierschke
wrote:
What about the idea to allow discussion entries/threads to be
linked to dub package entries?
So they appear in DUB and in a additional section of this
forum?
So vibe.d for example comes with his own forum that is good,
On Friday, 22 January 2016 at 12:54:38 UTC, Andrea Fontana wrote:
On Friday, 22 January 2016 at 12:05:48 UTC, userABCabc123 wrote:
when you add the first key, the value will be set to
JSON_TYPE.OBJECT
import std.json;
void main(string[] args)
{
JSONValue json;
json["first"] = 0;
On Friday, 22 January 2016 at 16:45:22 UTC, userABCabc123 wrote:
But soon or later you'll need to add values to your object so
just imagine it's already an object, even if it will only
become one when you'll start to add some values.
You're wrong, I need an empty object for an API call!
Moreo
On Fri, 22 Jan 2016 08:36:14 +, Kagamin wrote:
> Should be possible. Why not?
Because almost no IO routines in Phobos are marked @safe, which implies
that it's difficult in practice or that people simply haven't done it. I
checked std.file, std.net.curl, and std.stdio; a handful of things a
On Friday, 22 January 2016 at 14:06:42 UTC, Adam D. Ruppe wrote:
On Friday, 22 January 2016 at 12:18:53 UTC, anonymous wrote:
I don't know much about these things, but it seems to be the
`ret;`.
Right. This is an ordinary D function so the compiler generates
code to set up a stack for local v
On Friday, 22 January 2016 at 17:12:25 UTC, userABCabc123 wrote:
Note that there is maybe a DMD codegen bug because the asm
generated for the non naked version copy the result to the
stack and then the stack to result but after pmovmskb it's
already setup in EAX.
0044C580h push rbp
On Friday, 22 January 2016 at 16:58:51 UTC, Andrea Fontana wrote:
On Friday, 22 January 2016 at 16:45:22 UTC, userABCabc123 wrote:
But soon or later you'll need to add values to your object so
just imagine it's already an object, even if it will only
become one when you'll start to add some val
On Friday, 22 January 2016 at 13:03:52 UTC, Darrell Gallion wrote:
On Friday, 22 January 2016 at 11:23:56 UTC, Marc Schütz wrote:
On Friday, 22 January 2016 at 01:33:42 UTC, Darrell Gallion
wrote:
void foo(A)()
if (!is (A == int)) {
pragma(msg, "int");
}
void foo(A)()
if (i
On 1/22/2016 9:10 AM, Chris Wright via Digitalmars-d-learn wrote:
On Fri, 22 Jan 2016 08:36:14 +, Kagamin wrote:
Should be possible. Why not?
Because almost no IO routines in Phobos are marked @safe, which implies
that it's difficult in practice or that people simply haven't done it. I
ch
On Fri, Jan 22, 2016 at 11:15:58AM -0800, Brad Roberts via Digitalmars-d-learn
wrote:
> On 1/22/2016 9:10 AM, Chris Wright via Digitalmars-d-learn wrote:
> >On Fri, 22 Jan 2016 08:36:14 +, Kagamin wrote:
> >
> >>Should be possible. Why not?
> >
> >Because almost no IO routines in Phobos are ma
On 01/22/2016 07:41 AM, Darrell Gallion wrote:
Defining the template [specializations] within another function, fails.
Reported:
https://issues.dlang.org/show_bug.cgi?id=15592
Ali
On Friday, 22 January 2016 at 12:18:53 UTC, anonymous wrote:
int pmovmskb(byte16 v)
{
int r;
asm
{
movdqa XMM0, v;
pmovmskb EAX, XMM0;
mov r, EAX;
}
return r;
}
This code returns 0 for any input v
Removed the `inout` because it doesn't make
On 22.01.2016 21:34, Iakh wrote:
This code returns 0 for any input v
It seems to return 5 here: http://dpaste.dzfl.pl/85fb8e5c4b6b
On Friday, 22 January 2016 at 17:27:35 UTC, userABCabc123 wrote:
int pmovmskb(byte16 v)
{
asm
{
naked;
push RBP;
mov RBP, RSP;
sub RSP, 0x10;
movdqa dword ptr[RBP-0x10], XMM0;
movdqa XMM0, dword ptr[RBP-0x10];
pmovmskb EAX, XMM0;
On Friday, 22 January 2016 at 20:41:23 UTC, anonymous wrote:
On 22.01.2016 21:34, Iakh wrote:
This code returns 0 for any input v
It seems to return 5 here: http://dpaste.dzfl.pl/85fb8e5c4b6b
Yeah. Sorry. My bad.
On Friday, 22 January 2016 at 02:16:14 UTC, H. S. Teoh wrote:
On Thu, Jan 21, 2016 at 04:50:12PM -0800, H. S. Teoh via
Digitalmars-d-learn wrote:
[...]
> > https://github.com/quickfur/fastcsv
[...]
Fixed some boundary condition crashes and reverted doubled
quote handling in unquoted fie
On Friday, 22 January 2016 at 21:41:46 UTC, data pulverizer wrote:
On Friday, 22 January 2016 at 02:16:14 UTC, H. S. Teoh wrote:
[...]
Hi H. S. Teoh, I have used you fastcsv on my file:
import std.file;
import fastcsv;
import std.stdio;
import std.datetime;
void main(){
StopWatch sw;
sw
Hi
I am trying to create a simple shared library that exports a D
function, but when I try to link to it I get errors such as:
error LNK2001: unresolved external symbol _D7xxx12__ModuleInfoZ
Here xxx is the module inside the shared library.
I am using DMD and MS LINKER (Windows 64-bit) to c
On Friday, 22 January 2016 at 11:53:11 UTC, Andrea Fontana wrote:
If you declare a JSONValue like this:
JSONValue json;
then:
assert(json.type() == JSON_TYPE.NULL);
Documentation at
https://dlang.org/phobos/std_json.html#.JSONValue.type.2
suggests not to change type but to assign a new valu
On Friday, 22 January 2016 at 20:54:46 UTC, Iakh wrote:
On Friday, 22 January 2016 at 17:27:35 UTC, userABCabc123 wrote:
[...]
Thanks. It works.
Buth shorter version too:
asm
{
naked;
push RBP;
mov RBP
If I have:
interface A {}
class B : A {}
void printClass(A obj){
// Code here
}
Is there any way that I can find out what class obj is inside of
printClass? I know I can cast and check if(cast(B)obj) but I want
to just be able to do something along the lines of obj.class. I
can think of
On Friday, 22 January 2016 at 23:38:58 UTC, Josh Phillips wrote:
Is there any way that I can find out what class obj is inside
of printClass?
There's a .classinfo property that works on Objects.
If you have an interface, cast to Object first, and check for
null, then get .classinfo off that.
On Fri, 22 Jan 2016 11:38:51 -0800, H. S. Teoh via Digitalmars-d-learn
wrote:
> @safe still isn't quite there yet, because it doesn't quite prevent all
> of the things it ought to prevent.
Well, that makes it suboptimal, certainly. But having almost no existing
IO options that are @safe makes it
On Friday, 22 January 2016 at 12:07:11 UTC, abad wrote:
Let's say I have an array like this:
int[][][] array;
And I want to generate a linear int[] based on its data. Is
there a standard library method for achieving this, or must I
iterate over the array manually?
What I'm thinking of is so
On Friday, 22 January 2016 at 22:06:35 UTC, Dibyendu Majumdar
wrote:
Hi
I am trying to create a simple shared library that exports a D
function, but when I try to link to it I get errors such as:
error LNK2001: unresolved external symbol _D7xxx12__ModuleInfoZ
I have uploaded my small test
On Fri, 22 Jan 2016 17:34:58 +, userABCabc123 wrote:
> It's true that it can be problematic, for example with an input
> contract, or for subtyping a JSONValue as something like struct
> JSONValueThatAlwayObject{}...
>
> But there is only 3 ways in std.json, from a literal, using the
> depreca
On Fri, Jan 22, 2016 at 10:04:58PM +, data pulverizer via
Digitalmars-d-learn wrote:
[...]
> >$ dmd file_read_5.d fastcsv.d
> >$ ./file_read_5
> >Time (s): 0.679
> >
> >Fastest so far, very nice.
Thanks!
> I guess the next step is allowing Tuple rows with mixed types.
I thought about that
64 matches
Mail list logo