On 2012-04-24 23:30, sclytrack wrote:
Does it automatically pick everything to serialize?
Yes.
How would you make it more selective?
It depends on what you want to do.
struct Me
{
int x;
int y;
}
serialize x but not y.
In this simple case you can do like this:
struct Me
{
int x;
Hi. I'm having trouble calling a C function passing a structure
by value, printing a member and getting it back in D but I must
be doing something wrong.
I have a C file called native.c that defines a function called
'filter' taking a buf_t structure, I compile it using GCC to
native.o. From
Discussion here:
http://d.puremagic.com/issues/show_bug.cgi?id=5650
On my Windows box, the following program
import std.stdio, std.container, std.range;
void main() {
enum int range = 100;
enum int n = 1_000_000;
auto t = redBlackTree!int(0);
for (int i = 0; i < n; i++) {
On Wed, 25 Apr 2012 09:57:39 +0200, Johan Hernandez
wrote:
Hi. I'm having trouble calling a C function passing a structure by
value, printing a member and getting it back in D but I must be doing
something wrong.
Could be this one: http://d.puremagic.com/issues/show_bug.cgi?id=5570
Hi, I've just written a smallish program reading
lines from stdin and doing some parsing and other text
processing. I find it's about 3-4 times faster than a python
script I had doing the same thing, which is nice but not as good
as I hoped. After profiling, it seems almost half the total time
is
On 25.04.2012 15:10, aylwyn wrote:
Hi, I've just written a smallish program reading
lines from stdin and doing some parsing and other text
processing. I find it's about 3-4 times faster than a python
script I had doing the same thing, which is nice but not as good
as I hoped. After profiling, it
On 21/04/2012 19:24, H. S. Teoh wrote:
In finished code, it's obviously a bad thing to have unused variables
(unless the compiler optimizes them away,
Whether the compiler optimises it away or not, an unused variable is a code smell.
Complaining about unused variables serves as a warning to t
On Wednesday, 25 April 2012 at 08:34:40 UTC, SomeDude wrote:
Noone reproduces this ?
On Wed, 25 Apr 2012 13:30:09 +0200, Stewart Gordon
wrote:
On 21/04/2012 17:26, Andrej Mitrovic wrote:
Next thing you know the compiler will start warning me when I indent
my code with uneven number of spaces!
Or more usefully, warn if you have a mishmash of tab and space
indentation.
On 21/04/2012 17:26, Andrej Mitrovic wrote:
Next thing you know the compiler will start warning me when I indent
my code with uneven number of spaces!
Or more usefully, warn if you have a mishmash of tab and space indentation.
How do indent-sensitive languages (Haskell, Python, whatever else)
Dne 25.4.2012 13:27, SomeDude napsal(a):
On Wednesday, 25 April 2012 at 08:34:40 UTC, SomeDude wrote:
Noone reproduces this ?
Linux uriel 2.6.32-5-amd64 #1 SMP Wed Jan 12 03:40:32 UTC 2011 x86_64
GNU/Linux
DMD64 D Compiler v2.058
Commented writeln on average (10 runs) 40 ms slower.
So yes,
This is an interesting one that has cropped up. I'm curious if
this is because the differences between a fixed/dynamic arrays.
Working around it is easy enough but that it even does it is an
annoyance.
I'm not seeing this exact problem in the archives, and I am
not
sure if it's in the t
http://d.puremagic.com/issues/show_bug.cgi?id=7254 maybe?
-Steve
Am Mon, 16 Apr 2012 20:52:16 +0200
schrieb "Xan" :
> Uf!, it's more than I can process
> It's really a **complicated** thing to do that in D.
Too much information, yes. Too complicated no. :)
D is statically typed (Fantom allows both static and dynamic typing). That
means that for every vari
Hi,
I am trying to use a D static library from C on Mac OSX Lion, but
it always fails.
--- file mylib.d ---
module mylib;
import core.runtime;
extern(C) {
bool mylib_init() {
return Runtime.initialize();
}
bool mylib_free() {
re
s/void/int in main.c
These seem to be limited to uint.max length. Is there a way to
make larger bit arrays?
On 25/04/12 10:34, SomeDude wrote:
Discussion here: http://d.puremagic.com/issues/show_bug.cgi?id=5650
On my Windows box, the following program
import std.stdio, std.container, std.range;
void main() {
enum int range = 100;
enum int n = 1_000_000;
auto t = redBlackTree!int(0);
for (int i = 0
On Wed, 25 Apr 2012 07:27:29 -0400, SomeDude
wrote:
On Wednesday, 25 April 2012 at 08:34:40 UTC, SomeDude wrote:
Noone reproduces this ?
On my linux box, it runs in about 580ms, with or without the writeln.
This is what I would expect.
But things can be strange when dealing with GC timin
"bearophile" , dans le message (digitalmars.D.learn:35148), a écrit :
> Why don't you write a little benchmark to compare the performance
> of the two versions?
Because I'm interested in the code's meaning for the human reader, not
the performance.
I actually think : "map!(_=> uniform(a, b))(re
Al 25/04/12 13:27, En/na SomeDude ha escrit:
> On Wednesday, 25 April 2012 at 08:34:40 UTC, SomeDude wrote:
>
> Noone reproduces this ?
>
My results in Linux:
32-bit executable: About 574ms, with or without writeln.
64-bit executable: About 798ms, with or without writeln.
--
Jordi Sayol
Stanislav: I think you just hit the nail on the head with the
shared reference to this. I didn't even think of that as the
error message made me think of the parameter being shared.
As for solving it, I'll have to think about it. I was hoping to
just have a single queue class (Or any other i
ixid:
These seem to be limited to uint.max length. Is there a way to
make larger bit arrays?
Yeah, fixing the BigArray source :-)
It's limited by size_t.max length, that equals to uint.max on 32
bit systems.
It contains code like:
struct BitArray {
size_t len;
size_t* ptr;
@pr
Hello everyone,
I would like to know how to call ptrace (the system call) from D.
I don't know what to import or link. If my understanding is
correct, I need to create a .di file of some sort with stuff
declared in it. How would I do this?
Thanks, Matej
On Wednesday, 25 April 2012 at 15:35:44 UTC, Steven Schveighoffer
wrote:
On Wed, 25 Apr 2012 07:27:29 -0400, SomeDude
wrote:
On Wednesday, 25 April 2012 at 08:34:40 UTC, SomeDude wrote:
Noone reproduces this ?
On my linux box, it runs in about 580ms, with or without the
writeln.
This is
Am Wed, 25 Apr 2012 10:34:38 +0200
schrieb "SomeDude" :
> Discussion here:
> http://d.puremagic.com/issues/show_bug.cgi?id=5650
>
> On my Windows box, the following program
>
> import std.stdio, std.container, std.range;
>
> void main() {
> enum int range = 100;
> enum int n = 1_000_
On Wed, 25 Apr 2012 13:05:59 -0400, SomeDude
wrote:
On Wednesday, 25 April 2012 at 15:35:44 UTC, Steven Schveighoffer wrote:
On Wed, 25 Apr 2012 07:27:29 -0400, SomeDude
wrote:
On Wednesday, 25 April 2012 at 08:34:40 UTC, SomeDude wrote:
Noone reproduces this ?
On my linux box, it ru
On Wednesday, 25 April 2012 at 17:06:00 UTC, SomeDude wrote:
On Wednesday, 25 April 2012 at 15:35:44 UTC, Steven
Schveighoffer wrote:
On Wed, 25 Apr 2012 07:27:29 -0400, SomeDude
wrote:
On Wednesday, 25 April 2012 at 08:34:40 UTC, SomeDude wrote:
Noone reproduces this ?
On my linux box, i
More testing. This:
--- file mylib.d
module mylib;
import core.runtime;
import std.stdio;
extern(C) {
bool mylib_init() {
return Runtime.initialize();
}
bool mylib_free() {
return Runtime.terminate();
}
void mylib_
On Wed, Apr 25, 2012 at 10:34:38AM +0200, SomeDude wrote:
[...]
> import std.stdio, std.container, std.range;
>
> void main() {
> enum int range = 100;
> enum int n = 1_000_000;
>
> auto t = redBlackTree!int(0);
>
> for (int i = 0; i < n; i++) {
> if (i > range)
>
i search some example of something easy (more easy) to do in D an not
in another language if possible
- D - C++
- D - Haskell
- D - Java
- D - python
thanks a lot
On 4/25/12, Stewart Gordon wrote:
> Even if it's left over from debugging, it
> looks silly, and
> might lead other people reading the code to believe something's wrong.
There's about a million ways to make code unreadable, and nobody
writes pitch-perfect code that has absolutely no leftover code
On 4/25/12, Nicolas Sicard wrote:
> --- file main.c ---
> extern void mylib_init();
> extern void mylib_free();
Try changing void to bool there.
Am 25.04.2012 18:36, schrieb Matej Nanut:
> Hello everyone,
>
> I would like to know how to call ptrace (the system call) from D.
>
> I don't know what to import or link. If my understanding is correct, I
> need to create a .di file of some sort with stuff declared in it. How
> would I do this?
On Wednesday, 25 April 2012 at 17:59:38 UTC, Andrej Mitrovic
wrote:
On 4/25/12, Nicolas Sicard wrote:
--- file main.c ---
extern void mylib_init();
extern void mylib_free();
Try changing void to bool there.
This was a typo in my first post. The problem is elsewhere.
Thanks
How do I deal with this (on OSX); are CGI programs not allowed to
write to files? How to change this?
Thanks, NMS
test.d:
#!/usr/local/bin/rdmd
import std.stdio;
void main() {
writeln("Content-type: text/plain\r\n\r\nHello, World!");
}
error log:
[Wed Apr 25 00:03:01 2012] [error] [cli
On Wednesday, 25 April 2012 at 18:11:16 UTC, Nathan M. Swan wrote:
How do I deal with this (on OSX); are CGI programs not allowed
to
write to files? How to change this?
Thanks, NMS
test.d:
#!/usr/local/bin/rdmd
import std.stdio;
void main() {
writeln("Content-type: text/plain\r\n\r\nH
On Wednesday, 25 April 2012 at 08:38:02 UTC, simendsjo wrote:
Could be this one:
http://d.puremagic.com/issues/show_bug.cgi?id=5570
Thank you for your response.
It's a huge issue :(
Hi,
http://dlang.org/phobos/std_concurrency.html
Why does List(T) appear? Isn't it private?
--
- Alex
Does std.regex support input ranges to match()? Or do I need to convert
to string first?
Thanks!
T
--
Tell me and I forget. Teach me and I remember. Involve me and I understand. --
Benjamin Franklin
On 25/04/2012 17:10, Andrej Mitrovic wrote:
On 4/25/12, Stewart Gordon wrote:
Even if it's left over from debugging, it
looks silly, and
might lead other people reading the code to believe something's wrong.
There's about a million ways to make code unreadable, and nobody
writes pitch-perfect
On Wed, 25 Apr 2012 20:36:31 +0200, Johan Hernandez
wrote:
On Wednesday, 25 April 2012 at 08:38:02 UTC, simendsjo wrote:
Could be this one: http://d.puremagic.com/issues/show_bug.cgi?id=5570
Thank you for your response.
It's a huge issue :(
I agree. Let's hope it gets fixed now that it'
On 2012-04-25 20:36, Johan Hernandez wrote:
On Wednesday, 25 April 2012 at 08:38:02 UTC, simendsjo wrote:
Could be this one: http://d.puremagic.com/issues/show_bug.cgi?id=5570
Thank you for your response.
It's a huge issue :(
Compile as a 32bit binary. For DMD add "-m32" do the flags. For g
On Wednesday, April 25, 2012 21:00:33 Alex Rønne Petersen wrote:
> Hi,
>
> http://dlang.org/phobos/std_concurrency.html
>
> Why does List(T) appear? Isn't it private?
It's probably due to http://d.puremagic.com/issues/show_bug.cgi?id=2775
However, to make things weirder, it _doesn't_ have ddoc
On Wednesday, April 25, 2012 20:10:18 Stewart Gordon wrote:
> On 25/04/2012 17:10, Andrej Mitrovic wrote:
> > On 4/25/12, Stewart Gordon wrote:
> >> Even if it's left over from debugging, it
> >> looks silly, and
> >> might lead other people reading the code to believe something's wrong.
> >
> > T
Since there's only one *, it shouldn't show up in the docs, even if it's
public.
"If there is no documentation comment for a declaration, that
declaration may not appear in the output. To ensure it does appear in
the output, put an empty declaration comment for it."
http://dlang.org/ddoc.htm
On 4/25/12, Stewart Gordon wrote:
> So you think that
>
> import std.stdio;
> void main() {
> int a, b;
> a + b;
> return;
> writefln("Hello, world!");
> }
>
> should generate no errors or warnings whatsoever?
I'm really only talking about:
void a() {
int x;
}
And of course:
On 4/25/12, Andrej Mitrovic wrote:
> I'm really only talking about
Although I'm not a fan of warnings for unused variables, I would be a
fan of this: http://d.puremagic.com/issues/show_bug.cgi?id=3507
But again, other people might not like that. But if it was an option..
On Wed, Apr 25, 2012 at 04:03:04PM -0400, Jonathan M Davis wrote:
[...]
> increasingly I agree with Walter's take on warnings (that they
> shouldn't exist at all - something is an error or it isn't; none of
> this halfway stuff). Warnings are problematic in that a good
> programmer will _never_ lea
On Wednesday, April 25, 2012 22:01:45 Mirko Pilger wrote:
> > Since there's only one *, it shouldn't show up in the docs, even if it's
> > public.
>
> "If there is no documentation comment for a declaration, that
> declaration may not appear in the output. To ensure it does appear in
> the output,
On Wednesday, April 25, 2012 22:12:02 Andrej Mitrovic wrote:
> I'd like the warnings to be individually selectable, just like in GCC.
Having sets of warnings that you can explicitly enable makes a lot of sense,
because it enables the programmer to have the compiler warn about stuff that
they car
On 25.04.2012 23:08, H. S. Teoh wrote:
Does std.regex support input ranges to match()? Or do I need to convert
to string first?
For now, yes you have to convert them. Any random access range of code
units should do the trick but stringish template constraints might kill
that.
I plan to ext
On 25/04/2012 21:12, Andrej Mitrovic wrote:
I'm really only talking about:
void a() {
int x;
}
What is the distinction you're making exactly?
And of course:
void a() {
bool state;
...
if (state) { }
}
You mean an empty if body should trigger something? Or shouldn't?
OK, so I can see a si
On 4/25/12, Stewart Gordon wrote:
> What is the distinction you're making exactly?
> You mean an empty if body should trigger something? Or shouldn't?
I'm saying those are exactly the cases presented in the docs and I
don't want them to warn by default but have a setting. I mean, the
first case
On Wednesday, 25 April 2012 at 12:43:39 UTC, Steven Schveighoffer
wrote:
http://d.puremagic.com/issues/show_bug.cgi?id=7254 maybe?
Maybe... but it shouldn't be the wrong return; at least being a
static length known at compile-time should convert to char[4].
I'm not sure how try/catch would m
On 25/04/2012 12:30, Stewart Gordon wrote:
On 21/04/2012 17:26, Andrej Mitrovic wrote:
Next thing you know the compiler will start warning me when I indent
my code with uneven number of spaces!
Or more usefully, warn if you have a mishmash of tab and space indentation.
How do indent-sensitiv
On 04/25/2012 02:15 PM, Jonathan M Davis wrote:
On Wednesday, April 25, 2012 22:01:45 Mirko Pilger wrote:
Since there's only one *, it shouldn't show up in the docs, even if it's
public.
"If there is no documentation comment for a declaration, that
declaration may not appear in the output. To
On 4/26/12 1:51 AM, bioinfornatics wrote:
i search some example of something easy (more easy) to do in D an not
in another language if possible
- D - C++
...
- D - Haskell
- D - Java
- D - python
A segmentation fault is really easy to do in D but hard in those
languages. :-P
Hi there,
In c++ one can access a pointer to a class/struct variable using
this semantic:
struct C {
int x;
};
int C::* ptr = &C::x;
C foo;
foo.*ptr = 10;
assert(foo.x == 10);
It is possible to do something like that on D? I've searched
through the forum & documentation but didn't found
On Wednesday, April 25, 2012 17:31:29 Ali Çehreli wrote:
> On 04/25/2012 02:15 PM, Jonathan M Davis wrote:
> > On Wednesday, April 25, 2012 22:01:45 Mirko Pilger wrote:
> >>> Since there's only one *, it shouldn't show up in the docs, even if it's
> >>> public.
> >>
> >> "If there is no documentat
Have you checked that your web server has write access to
/Users/nathanmswan/Sites/ ?
Yes, it works now, thanks!
NMS
P.S. Sorry this might be in the wrong forum, but now I can
advertise my homepage as "index.d" instead of compiling it and
having it be "index.cgi"
On Thursday, 26 April 2012 at 02:43:35 UTC, Victor Vicente de
Carvalho wrote:
Hi there,
In c++ one can access a pointer to a class/struct variable
using this semantic:
struct C {
int x;
};
int C::* ptr = &C::x;
C foo;
foo.*ptr = 10;
assert(foo.x == 10);
It is possible to do something lik
Thank you, I will have a play with that.
On Thursday, 26 April 2012 at 03:54:25 UTC, Nathan M. Swan wrote:
Yes. My rule: don't use pointers unless doing it otherwise is
really slow or really hard.
Might be safe to use a pointer on an immutable struct (Say,
globally accessible data?). I'm trying this; but it's only to get
around the
On Thu, Apr 26, 2012 at 06:57:50AM +0200, EraScarecrow wrote:
> On Thursday, 26 April 2012 at 03:54:25 UTC, Nathan M. Swan wrote:
> >Yes. My rule: don't use pointers unless doing it otherwise is
> >really slow or really hard.
>
> Might be safe to use a pointer on an immutable struct (Say,
> globa
On Thursday, 26 April 2012 at 05:16:51 UTC, H. S. Teoh wrote:
Besides, D's auto-deferencing semantics on pointers
makes the difference barely noticeable anyway. Pointers
auto-deference when using '.' member notation, for example. Once
in a while you have to explicitly dereference a pointer or
On Wednesday, 25 April 2012 at 17:52:36 UTC, bioinfornatics wrote:
i search some example of something easy (more easy) to do in D
an not
in another language if possible
- D - C++
- D - Haskell
- D - Java
- D - python
thanks a lot
Associative arrays?
C++:
#include
#include
map m;
Java:
Am Sun, 22 Apr 2012 09:23:45 +0200
schrieb "Jay Norwood" :
> On Sunday, 22 April 2012 at 06:26:42 UTC, Jonathan M Davis wrote:
> >
> > You can look at the code. It checks each of the characters in
> > place. Unlike
> > toLower, it doesn't need to generate a new string. But as far
> > as the
> >
On Wednesday, April 25, 2012 19:51:18 bioinfornatics wrote:
> i search some example of something easy (more easy) to do in D an not
> in another language if possible
> - D - C++
> - D - Haskell
> - D - Java
> - D - python
>
> thanks a lot
Pretty much everything that Andrei talks about in this re
Am Sun, 22 Apr 2012 23:47:20 +0200
schrieb "SomeDude" :
> void main() {
> auto array = new Foo[10];
> --> for(int i = array.length; i > 1; i--) { array[i].x = i; }
> writeln();
> foreach(Foo f; array) { write(f.x);}
> }
>
> throws core.exception.RangeError@bug(8): Range violation o
70 matches
Mail list logo