Re: Printing stacktrace on segfault

2012-03-27 Thread Jérôme M. Berger
simendsjo wrote: Is there a way to print a stacktrace on segfaults on linux? catchsegv (part of glibc, so should be available on just about all Linux distros...) Jerome -- mailto:jeber...@free.fr http://jeberger.free.fr Jabber: jeber...@jabber.fr signature.asc

Re: How to avoid code duplication in static if branches?

2012-03-03 Thread Jérôme M. Berger
Andrej Mitrovic wrote: ...snip... I want to avoid writing check() twice. I only have to statically check a field of a member if it's of a certain type (Foo). One solution would be to use a boolean: void test(T)(T t) { bool isTrue = true; static if (is(T == Foo)) isTrue =

Re: gdc setup without gcc

2011-09-01 Thread Jérôme M. Berger
%u wrote: I have 2 issue: 1- i can't install the package, there is problem I don't know what is it? What is the error? 2-it is not updated. It is not flagged out of date either. AFAIK it should compile and since it downloads the latest source from Mercurial, there is no need to

Re: inline functions

2011-03-26 Thread Jérôme M. Berger
bearophile wrote: I have not found a quick way to let GCC vectorize this code, using two multiplications with one SSE instructions, I am not sure GCC is able to do this automatically. Even with -ftree-vectorize? AFAIK it is considered experimental and needs to be turned on

Re: dmd gdc in archlinux

2011-03-07 Thread Jérôme M. Berger
%u wrote: == Quote from %u (asm...@hotmail.com)'s article i can't install it and i use this command yaourt -R gdc i mean yaourt -S gdc The gdc package is woefully out of date. You should install either gdc1-hg (for D1) or gdc2-hg (for D2) both of which are reasonably maintained

Re: dmd gdc in archlinux

2011-03-06 Thread Jérôme M. Berger
%u wrote: i can't install dmd or gdc in arch linux from AUR i don't way? For gdc, which package exactly are you trying to install? On what platform (32 or 64 bits)? And what error do you get? Jerome -- mailto:jeber...@free.fr http://jeberger.free.fr Jabber:

Re: Wrapping C that uses compiler extensions

2011-03-05 Thread Jérôme M. Berger
simendsjo wrote: On 05.03.2011 08:58, Jérôme M. Berger wrote: simendsjo wrote: On 04.03.2011 22:42, Jérôme M. Berger wrote: int main(string[] args) { auto s1 =(); // MH MH auto s2 =(); // OK s2.c =ull; // OK return 0; } Is part of your message gone? Uh, I did

Re: Wrapping C that uses compiler extensions

2011-03-04 Thread Jérôme M. Berger
simendsjo wrote: This code confuses me... It's from the c mysql windows dll, libmysql.dll. size_t (*snprintf)(struct charset_info_st *, char *to, size_t n, const char *fmt, ...) ATTRIBUTE_FORMAT_FPTR(printf, 4, 5); You can safely ignore

Re: Ini parsing library in D ?

2011-02-28 Thread Jérôme M. Berger
Tarun Ramakrishna wrote: Hi, Do we have a ini parser in D somewhere ? If not, is there some documentation anywhere that tells one how to wrap a simple C++ library like simple ini ? (Of course it isn't difficult to build a quick parser, just that someone would done this already)

Re: Assigning Interface to Object

2011-01-16 Thread Jérôme M. Berger
Stewart Gordon wrote: On 15/01/2011 17:44, Steven Schveighoffer wrote: snip Which unnecessarily complicates things. For example, you can't compare two interfaces (try it!). ? interface I {} ... I a = ...; I b = ...; if (a == b) // -- ERROR -- mailto:jeber...@free.fr

Re: How the GC distinguishes code from data

2011-01-06 Thread Jérôme M. Berger
%u wrote: Hi, There's a question that's been lurking in the back of my mind ever since I learned about D: How does the GC distinguish code from data when determining the objects to collect? (E.g. void[] from uint[], size_t from void*, etc.?) If I have a large uint[], it's practically

Re: discrimination of constructors with same number of parameters

2010-12-30 Thread Jérôme M. Berger
Steven Schveighoffer wrote: What I would suggest is static factory methods. The issue with any kind of typedef (be it with the soon-to-be-deprecated typedef keyword or with a proxy struct), is that what does this mean? auto obj = new Foo([1, 2, 3], blah); Is blah a filename or a message?

Re: Undefined references when linking to C library

2010-12-23 Thread Jérôme M. Berger
Peter Federighi wrote: Jonathan M Davis wrote: Did you wrap the C declarations in an extern(C) block? Without that, it's going to think that your variables are D variables not C variables. The same goes for any functions - _especially_ for the functions. In fact, a large portion of - in

Re: Strange socket error

2010-12-21 Thread Jérôme M. Berger
Bob Cowdery wrote: Hi all, This is a long shot but I'm out of ideas. I ported an app from Windows to Linux and after many issues it is working but I'm left with a strange problem. The app basically reads data streams from a USB device, processes them and outputs real-time graphical data to

Re: sleepy receiveTimeout?

2010-12-19 Thread Jérôme M. Berger
Nick Voronin wrote: On Sat, 18 Dec 2010 23:19:47 +0100 Joost 't Hart joost.t.h...@planet.nl wrote: Quoting the documentation: /Suspends the calling thread for at least the supplied period./ What does at least mean here? Is there also an at most? I do not want my friend to end up in

Re: Error: non-constant expression...

2010-11-27 Thread Jérôme M. Berger
bearophile wrote: Jonathan M Davis: At present, I don't believe that associative arrays are valid CTFE You are wrong, the current situation with AAs is not so simple :-) string foo(string k) { string[string] map = [bar : spam]; return map[k]; } enum string v = foo(bar);

Re: Class template argument deduction from constructor call

2010-10-28 Thread Jérôme M. Berger
Steven Schveighoffer wrote: On Wed, 27 Oct 2010 16:26:21 -0400, div0 d...@sourceforge.net wrote: class Foo(T) { this(T t) { bar = t; } this(string x) { } this(int x) { } T bar; } autof0 = new Foo(wtf?); autof1 = new

Re: A question about DbC

2010-10-09 Thread Jérôme M. Berger
bearophile wrote: Jonathan M Davis: if the state couldn't have changed since the last public function call, the running the invariant before the function call is pointless. The post-condition of a method doesn't need to make sure the class is in a correct state, all it has to test is

Re: A question about DbC

2010-10-09 Thread Jérôme M. Berger
bearophile wrote: J. Berger: Jonathan's point is not about running the post-condition and the invariant. It is about running the invariant twice: both before and after the function. This is completely independent from any pre- or post-conditions there may be. You are missing

Re: Segmentation fault on closing file in destructor

2010-09-26 Thread Jérôme M. Berger
Tom Kazimiers wrote: Hi Simen, On 09/26/2010 04:06 PM, Simen kjaeraas wrote: Likely, it is this[1]: [T]he order in which the garbage collector calls destructors for unreference objects is not specified. This means that when the garbage collector calls a destructor for an object of a class

Re: Mixing operations with signed and unsigned types

2010-07-08 Thread Jérôme M. Berger
Stewart Gordon wrote: Ellery Newcomer wrote: On 07/06/2010 07:05 PM, Stewart Gordon wrote: snip Just using uint, of course! For enforcing a non-negative constraint, that is brain damaged. Semantically, the two are very different. So effectively, the edit wars would be between people

Re: Synchronized const methods

2010-06-12 Thread Jérôme M. Berger
Daniel Keep wrote: immutable means no one can modify this. const means someone might be able to modify this, but not you can't. So? Basically, what the OP said, is that we need readers-writer locks [1]. A const synchronized method would use the read lock (and therefore

Re: Loop optimization

2010-05-16 Thread Jérôme M. Berger
div0 wrote: Jérôme M. Berger wrote: div0 wrote: Jérôme M. Berger wrote: That depends. In C/C++, the default value for any global variable is to have all bits set to 0 whatever that means for the actual data type. No it's not, it's always uninitialized. According to the C89

Re: Loop optimization

2010-05-15 Thread Jérôme M. Berger
div0 wrote: Jérôme M. Berger wrote: That depends. In C/C++, the default value for any global variable is to have all bits set to 0 whatever that means for the actual data type. No it's not, it's always uninitialized. According to the C89 standard and onwards it *must

Re: Loop optimization

2010-05-14 Thread Jérôme M. Berger
bearophile wrote: kai: I was scared off by the warning that D 2.0 support is experimental. LDC is D1 still, mostly :-( And at the moment it uses LLVM 2.6. LLVM 2.7 contains a new optimization that can improve that code some more. Good to know, thanks (thats actually a great feature

Re: Newsgroups, off-topic

2010-04-18 Thread Jérôme M. Berger
Simen kjaeraas wrote: Joseph Wakeling joseph.wakel...@webdrake.net wrote: Maybe true, but I was thinking of it from a different angle -- why the main D2 development does not switch backends. So which do you suggest be used instead - the one that doesn't work on Windows (no exceptions) or

Re: Running external program from a D program [D2]

2010-02-22 Thread Jérôme M. Berger
Jonathan M Davis wrote: Jesse Phillips wrote: As you may have noticed by the comments to on bug 3158. exec()[1] calls replace your process, this means it will not continue your program. To get arround this you find that people will first fork()[2] and exec on the child process. Ah yes.

Re: DMD on x86_64

2010-02-17 Thread Jérôme M. Berger
Don't forget that gcc adds a couple of system libraries (like libgcc) to the linker command. You need to give the right path for those too (you might want to try with --sysroot, or use --nostdlib and specify -lgcc manually) Jerome -- mailto:jeber...@free.fr

Re: floating point verification using is?

2009-12-30 Thread Jérôme M. Berger
Don wrote: Steven Schveighoffer wrote: That value should always be consistent. There has to be a way to verify that the value was set properly. Otherwise, how do you verify things like communication protocols or expectations for runtime functions? I think that sending an uninitialized

Re: The length of strings vs. # of chars vs. sizeof

2009-11-01 Thread Jérôme M. Berger
Rainer Deyke wrote: Charles Hixson wrote: I've read and re-read the documentation, but I can't decide whether a UTF-8 character that takes multiple bytes to express counts as one or multiple values in length and sizeof. Sizeof seems to presume that all entries are the same length, but

Re: Any way to workaround Optlink crash?

2009-09-02 Thread Jérôme M. Berger
div0 wrote: Jérôme M. Berger wrote: Max Samukha wrote: Tom S wrote: Max Samukha wrote: COFF/ELF output would not be that bad though, at least if there's some linker that supports these *and* its license allows it to be bundled with DMD. I doubt such a linker exists. And if it does, I doubt

Re: How to release memory? (D2.0.30)

2009-07-05 Thread Jérôme M. Berger
downs wrote: BCS wrote: Hello AxelS, BCS Wrote: You can't. The D runtime (and most other runtimes) don't ever reduce the amount of memory they keep in the heap. If you where to allocate another 25MB right after that function you would see no change in the memory usage. The good news is that

Re: legal identifier check

2009-06-01 Thread Jérôme M. Berger
BCS wrote: Hello Saaa, You have to write it yourself. Here's a good starting point: http://www.digitalmars.com/d/1.0/lex.html#identifier Yes, that was my starting point and it seemed quite complex, thus my question :) I think I'll stay with my simple check for now as it isn't really

Re: confusing (buggy?) closure behaviour

2008-12-12 Thread Jérôme M. Berger
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Zoran Isailovski wrote: I'm an experienced C#, Java and Python programmer, and have employed closures (and C# delegates) upon numerous occasions. While experimenting with D closures and delegates, I was stroke by a phenomenon I cannot explain.