Re: DMD on linux? (more problems)

2011-03-02 Thread Jacob Carlborg
On 2011-03-03 00:43, Sean Eskapp wrote: I'm still having issues with the linux dmd. Here's the relevant part of the output: ... function func function func gcc Nullimorphism.o -o Nullimorphism.exe -g -m32 -l -Xlinker - L/usr/lib32 -Xlinker -L/usr/lib64 -Xlinker --no-warn-search-mismatch -Xlink

Re: std.zlib and other tools

2011-03-02 Thread Johannes Pfau
Jesse Phillips wrote: >I'm just wondering if anyone else has an issue with using std.zlib >with other programs such as gzip and 7-zip? zlib creates and loads gz >files right? > >The library works perfectly with itself, but I can't read or write >compressed files from other popular programs. > >mpor

Re: Parameterized Structs

2011-03-02 Thread Ali Çehreli
On 03/02/2011 11:11 PM, Peter Lundgren wrote: > == Quote from Ali Çehreli (acehr...@yahoo.com)'s article >> On 03/02/2011 08:56 PM, Peter Lundgren wrote: >>> Where can I go to learn about parameterized structs? I can't seem to find any >>> literature on the subject. In particular, what are you al

Re: Struct reference returning function and const members

2011-03-02 Thread Jonathan M Davis
On Wednesday 02 March 2011 22:42:18 Tom wrote: > I have... > > int main(string[] args) { > auto s1 = f(); // MH MH > auto s2 = g(); // OK > s2.c = null; // OK > return 0; > } > > class C {} > > struct StructWithConstMember { > this(int i, C c) { this.i=i; this.c=c;

Re: Two questions about "%a"

2011-03-02 Thread Lars T. Kyllingstad
On Wed, 02 Mar 2011 13:35:11 +0100, Magnus Lie Hetland wrote: > First question: I just noticed that writefln("%a", 1.2) writes > 0x1.3p+0, while writeln(format("%a", 1.2)) (that is, with > std.string.format) writes 0x9.8p-3 ... wouldn't it be nice > to be consistent here? (

Re: Parameterized Structs

2011-03-02 Thread Peter Lundgren
== Quote from Ali Çehreli (acehr...@yahoo.com)'s article > On 03/02/2011 08:56 PM, Peter Lundgren wrote: > > Where can I go to learn about parameterized structs? I can't seem to find > > any > > literature on the subject. In particular, what are you allowed to use as a > > parameter? I would like

Re: Struct reference returning function and const members

2011-03-02 Thread Tom
El 03/03/2011 03:47, Ali Çehreli escribió: On 03/02/2011 10:42 PM, Tom wrote: I have... int main(string[] args) { auto s1 = f(); // MH MH auto s2 = g(); // OK s2.c = null; // OK return 0; } class C {} struct StructWithConstMember { this(int i, C c) { this.i=i; this.c=c; } int i; const(C) c; }

Re: Struct reference returning function and const members

2011-03-02 Thread Ali Çehreli
On 03/02/2011 10:42 PM, Tom wrote: I have... int main(string[] args) { auto s1 = f(); // MH MH auto s2 = g(); // OK s2.c = null; // OK return 0; } class C {} struct StructWithConstMember { this(int i, C c) { this.i=i; this.c=c; } int i; const(C) c; } struct StructWithoutConstMember { this(int

Struct reference returning function and const members

2011-03-02 Thread Tom
I have... int main(string[] args) { auto s1 = f(); // MH MH auto s2 = g(); // OK s2.c = null; // OK return 0; } class C {} struct StructWithConstMember { this(int i, C c) { this.i=i; this.c=c; } int i; const(C) c; } struct StructWithoutCo

Re: Parameterized Structs

2011-03-02 Thread Ali Çehreli
On 03/02/2011 08:56 PM, Peter Lundgren wrote: Where can I go to learn about parameterized structs? I can't seem to find any literature on the subject. In particular, what are you allowed to use as a parameter? I would like to define a struct like so: struct MyStruct(T, T[] a) { ... } but I

Re: Parameterized Structs

2011-03-02 Thread Bekenn
On 3/2/2011 8:56 PM, Peter Lundgren wrote: Where can I go to learn about parameterized structs? I can't seem to find any literature on the subject. In particular, what are you allowed to use as a parameter? I would like to define a struct like so: struct MyStruct(T, T[] a) { ... } but I re

Re: Parameterized Structs

2011-03-02 Thread Jonathan M Davis
On Wednesday 02 March 2011 20:56:41 Peter Lundgren wrote: > Where can I go to learn about parameterized structs? I can't seem to find > any literature on the subject. In particular, what are you allowed to use > as a parameter? I would like to define a struct like so: > > struct MyStruct(T, T[] a)

Parameterized Structs

2011-03-02 Thread Peter Lundgren
Where can I go to learn about parameterized structs? I can't seem to find any literature on the subject. In particular, what are you allowed to use as a parameter? I would like to define a struct like so: struct MyStruct(T, T[] a) { ... } but I receive the following error: Error: arithmetic/

Re: DMD on linux? (more problems)

2011-03-02 Thread Jesse Phillips
Sean Eskapp Wrote: > I'm still having issues with the linux dmd. Here's the relevant part > of the output: > > ... > function func > function func > gcc Nullimorphism.o -o Nullimorphism.exe -g -m32 -l -Xlinker - > L/usr/lib32 -Xlinker -L/usr/lib64 -Xlinker --no-warn-search-mismatch > -Xlinker -

DMD on linux? (more problems)

2011-03-02 Thread Sean Eskapp
I'm still having issues with the linux dmd. Here's the relevant part of the output: ... function func function func gcc Nullimorphism.o -o Nullimorphism.exe -g -m32 -l -Xlinker - L/usr/lib32 -Xlinker -L/usr/lib64 -Xlinker --no-warn-search-mismatch -Xlinker --export-dynamic -lrt -lphobos2 -lpthre

Re: DMD on linux?

2011-03-02 Thread Sean Eskapp
== Quote from Jonathan M Davis (jmdavisp...@gmx.com)'s article > On Wednesday, March 02, 2011 13:52:29 Sean Eskapp wrote: > > I'm trying to work with D on Ubuntu, but I keep having this issue: > > > > ... > > function func > > function func > > gcc Nullimorphism.o -o Nullimorphism.exe -g -m32 -l

std.zlib and other tools

2011-03-02 Thread Jesse Phillips
I'm just wondering if anyone else has an issue with using std.zlib with other programs such as gzip and 7-zip? zlib creates and loads gz files right? The library works perfectly with itself, but I can't read or write compressed files from other popular programs. mport std.stdio; import std.file

Re: DMD on linux?

2011-03-02 Thread Robert Clipsham
On 02/03/11 21:52, Sean Eskapp wrote: I'm trying to work with D on Ubuntu, but I keep having this issue: ... function func function func gcc Nullimorphism.o -o Nullimorphism.exe -g -m32 -l -Xlinker -L/usr/bin/../lib32 -Xlinker - L/usr/bin/../lib64 -Xlinker --no-warn-search-mismatch -Xlinker -

Re: DMD on linux?

2011-03-02 Thread Jonathan M Davis
On Wednesday, March 02, 2011 13:52:29 Sean Eskapp wrote: > I'm trying to work with D on Ubuntu, but I keep having this issue: > > ... > function func > function func > gcc Nullimorphism.o -o Nullimorphism.exe -g -m32 -l -Xlinker > -L/usr/bin/../lib32 -Xlinker - L/usr/bin/../lib64 -Xlinker > --no

DMD on linux?

2011-03-02 Thread Sean Eskapp
I'm trying to work with D on Ubuntu, but I keep having this issue: ... function func function func gcc Nullimorphism.o -o Nullimorphism.exe -g -m32 -l -Xlinker -L/usr/bin/../lib32 -Xlinker - L/usr/bin/../lib64 -Xlinker --no-warn-search-mismatch -Xlinker --export-dynamic -lrt - lphobos2 -lpthre

Re: Template argument deduction

2011-03-02 Thread Tom
El 01/03/2011 16:05, Ali Çehreli escribió: On 02/28/2011 07:39 PM, Tom wrote: > foo([[1,2],[3,4],[5,6]]); // ERROR [1] > bar([[1,2],[3,4],[5,6]]); // OK > foo!int([[1,2],[3,4],[5,6]]); // OK ... > void foo(T)(T[2][] t) { > writeln(typeid(t)); > } > > void bar(T)(T[][] t) { > writeln(t

Re: Can't figure out segfault

2011-03-02 Thread Mike Wey
On 03/02/2011 01:49 AM, rm wrote: I put together bindings for DevIL in D to use on a school assignment. The bindings (attached) work fine on Windows, but cause a segfault on Linux when I call ilInit. this can be demonstrated by a little test program " import graphics.bindings.devil; public vo

Re: Some weird crashes

2011-03-02 Thread Bekenn
On 3/2/11 10:52 AM, simendsjo wrote: I couldn't find a free download for coff2omf, that's why I don't use the supplied .lib. You can use coffimplib: ftp://ftp.digitalmars.com/coffimplib.zip

Re: Some weird crashes

2011-03-02 Thread simendsjo
On 02.03.2011 18:24, Denis Koroskin wrote: On Tue, 01 Mar 2011 23:01:21 +0300, simendsjo wrote: On 28.02.2011 20:24, Denis Koroskin wrote: On Mon, 28 Feb 2011 22:04:44 +0300, simendsjo wrote: On 28.02.2011 18:52, simendsjo wrote: // ERROR auto res = mysql_library_init(0, null, null); au

Re: About const and C functions

2011-03-02 Thread Bekenn
On 3/2/11 4:06 AM, bearophile wrote: Can't D/DMD err on the side of safety and consider the C-style variadic argument as not const, and so produce an error if you give to them something that's D const/immutable (and require a cast there)? (Especially a function like sscanf where the third and

Re: comparing pointers passed to and returned from funcs

2011-03-02 Thread spir
On 03/02/2011 02:24 PM, Steven Schveighoffer wrote: On Tue, 01 Mar 2011 18:11:00 -0500, bearophile wrote: http://d.puremagic.com/issues/show_bug.cgi?id=5678 I think there is a general bug where any time the compiler uses an enum, it simply replaces the expression declared for the enum. So b

Re: Some weird crashes

2011-03-02 Thread Denis Koroskin
On Tue, 01 Mar 2011 23:01:21 +0300, simendsjo wrote: On 28.02.2011 20:24, Denis Koroskin wrote: On Mon, 28 Feb 2011 22:04:44 +0300, simendsjo wrote: On 28.02.2011 18:52, simendsjo wrote: // ERROR auto res = mysql_library_init(0, null, null); auto cn = mysql_init(null); auto oldcn = cn;

Re: comparing pointers passed to and returned from funcs

2011-03-02 Thread Steven Schveighoffer
On Tue, 01 Mar 2011 18:11:00 -0500, bearophile wrote: http://d.puremagic.com/issues/show_bug.cgi?id=5678 I think there is a general bug where any time the compiler uses an enum, it simply replaces the expression declared for the enum. So basically enum TRUE = new DElement(true); void

Re: Constructor template -- bug?

2011-03-02 Thread Jacob Carlborg
On 2011-03-02 09:07, Jonathan M Davis wrote: On Tuesday 01 March 2011 23:52:38 Jacob Carlborg wrote: On 2011-03-02 08:47, Jonathan M Davis wrote: On Tuesday 01 March 2011 23:43:27 Jonathan M Davis wrote: On Tuesday 01 March 2011 22:18:49 Bekenn wrote: Code: class MyException : Excepti

Re: @property ref foo() { ...} won't work...?

2011-03-02 Thread Magnus Lie Hetland
On 2011-03-01 13:20:18 +0100, Steven Schveighoffer said: On Tue, 01 Mar 2011 07:19:21 -0500, Lars T. Kyllingstad wrote: On Tue, 01 Mar 2011 12:25:30 +0100, Magnus Lie Hetland wrote: 2. How can I make r.front = foo work, when I only have r.front(), returning a ref (which seems like it is us

Two questions about "%a"

2011-03-02 Thread Magnus Lie Hetland
First question: I just noticed that writefln("%a", 1.2) writes 0x1.3p+0, while writeln(format("%a", 1.2)) (that is, with std.string.format) writes 0x9.8p-3 ... wouldn't it be nice to be consistent here? (The former is what printf in gcc gives.) Or am I missing a differen

Re: About const and C functions

2011-03-02 Thread bearophile
Bekenn: > I'm not sure that's checkable. I think this falls squarely into the > realm of "undefined behavior". The signature of sscanf is something like: int sscanf(char* str, char* format, ...); Can't D/DMD err on the side of safety and consider the C-style variadic argument as not const, and

Re: About const and C functions

2011-03-02 Thread Simon
On 02/03/2011 11:28, Simon wrote: On 02/03/2011 08:56, Trass3r wrote: Am 01.03.2011, 23:33 Uhr, schrieb bearophile : Do you know why DMD doesn't give a compilation error here? import core.stdc.stdio: sscanf; immutable int value = 5; void main() { sscanf("10".ptr, "%d".ptr, &value); } What

Re: About const and C functions

2011-03-02 Thread Simon
On 02/03/2011 08:56, Trass3r wrote: Am 01.03.2011, 23:33 Uhr, schrieb bearophile : Do you know why DMD doesn't give a compilation error here? import core.stdc.stdio: sscanf; immutable int value = 5; void main() { sscanf("10".ptr, "%d".ptr, &value); } What's the D signature of sscanf? voi

Re: Can't figure out segfault

2011-03-02 Thread Daniel Murphy
Assuming you've checked that dlopen isn't returning null, I can't find the source of the error in that code, sorry. Unsolicited advice: Is there any reason you're manually loading the dll rather than using an import library? A couple of remarks about the rest of the code: Generally in D the c

Re: About const and C functions

2011-03-02 Thread Trass3r
Am 01.03.2011, 23:33 Uhr, schrieb bearophile : Do you know why DMD doesn't give a compilation error here? import core.stdc.stdio: sscanf; immutable int value = 5; void main() { sscanf("10".ptr, "%d".ptr, &value); } What's the D signature of sscanf?

Re: Constructor template -- bug?

2011-03-02 Thread Jonathan M Davis
On Wednesday 02 March 2011 00:14:55 Bekenn wrote: > On 3/1/2011 11:47 PM, Jonathan M Davis wrote: > > I should also point out that there is absolutely no need to use template > > for what you're trying to do. Just declare the constructor like so: > > > > this(string message, string file = __FILE__

Re: Constructor template -- bug?

2011-03-02 Thread Bekenn
On 3/1/2011 11:47 PM, Jonathan M Davis wrote: I should also point out that there is absolutely no need to use template for what you're trying to do. Just declare the constructor like so: this(string message, string file = __FILE__, size_t line = __LINE__ Throwable next = null) { ... } You are

Re: Constructor template -- bug?

2011-03-02 Thread Jonathan M Davis
On Tuesday 01 March 2011 23:52:38 Jacob Carlborg wrote: > On 2011-03-02 08:47, Jonathan M Davis wrote: > > On Tuesday 01 March 2011 23:43:27 Jonathan M Davis wrote: > >> On Tuesday 01 March 2011 22:18:49 Bekenn wrote: > >>> Code: > >>> class MyException : Exception > >>> { > >>> > >>>