Re: Compound assignment operators

2010-08-26 Thread bearophile
Yao G.: Is there a way to make this work? Even changing the operator string in opBinary to - doesn't do nothing. Or those kind of operators can't be overloaded? Try opOpAssign. Bye, bearophile

Re: Compound assignment operators

2010-08-26 Thread Jonathan M Davis
On Wednesday 25 August 2010 22:31:38 Yao G. wrote: Sorry, I sent the message prematurely :( Anyway, here's complete: Is there a way to make compound assignment operators (-=, +=, *= and friends) work with D's operator overload regime? I can't make them work. Look at

Re: Compound assignment operators

2010-08-26 Thread Yao G.
On Thu, 26 Aug 2010 01:46:02 -0500, Jonathan M Davis jmdavisp...@gmail.com wrote: Look at http://www.digitalmars.com/d/2.0/operatoroverloading.html (or even better, TDPL). The correct function would be opOpAssign. I believe that the syntax for += would be opOpAssign!(+)(args) { } -

Re: Three floating point questions

2010-08-26 Thread Don
bearophile wrote: Don: Do you know what cast(ulong) is doing here? Turning it from a signalling nan to a quiet nan. I really really didn't know this. Is this written somewhere in the D docs? :-) It's the way signalling nans work. _Any_ use of them raises a floating point exception, then

Debugging in D?

2010-08-26 Thread Era Scarecrow
I'm using dmd v2.048, WinDbg 5.1. I seem to be having trouble, perhaps i can get this cleared up. I'm trying to build a new structure type using math overloads (for testing). My asserts are failing; i need to debug them but can't. I've run 'dmd -gc mysource.d' as per the site, neither gdb

Re: Compound assignment operators

2010-08-26 Thread Jonathan M Davis
On Wednesday 25 August 2010 23:49:27 Yao G. wrote: On Thu, 26 Aug 2010 01:46:02 -0500, Jonathan M Davis jmdavisp...@gmail.com wrote: Look at http://www.digitalmars.com/d/2.0/operatoroverloading.html (or even better, TDPL). The correct function would be opOpAssign. I believe that the

Re: Debugging in D?

2010-08-26 Thread Trass3r
You could try cv2pdb.

Re: Ways to initialize static arrays

2010-08-26 Thread Stanislav Blinov
Sorry, I pressed the wrong button so the message was sent to your email. Reciting: 26.08.2010 1:53, Philippe Sigaud wrote: I came up with the templates in my initial post. They seem to work, but I doubt those are legal solutions. . If they work, then they are legal :) How

Re: Debugging in D?

2010-08-26 Thread Era Scarecrow
== Quote from Trass3r (u...@known.com)'s article You could try cv2pdb. I'll look it up. I'm trying ddbg, and although it is working so far, there has to be something better (At least giving it commands and breakpoints)

Re: TDPL: Operator Overloading

2010-08-26 Thread Philippe Sigaud
On Wed, Aug 25, 2010 at 17:27, Andrej Mitrovic andrej.mitrov...@test.comwrote: What would be really cool is if we had a property that returned a random value of any integrated type. And for user-defined types, maybe it would call a method with a special name. I guess one could make a template

Re: Debugging in D?

2010-08-26 Thread Trass3r
I'll look it up. I'm trying ddbg, and although it is working so far, there has to be something better (At least giving it commands and breakpoints) Isn't ddbg dead? Your best shot is to debug on Windows using cv2pdb or the upcoming Mago Debugger plugin with Visual Studio.

Re: easier way?

2010-08-26 Thread Philippe Sigaud
On Thu, Aug 26, 2010 at 03:50, bearophile bearophileh...@lycos.com wrote: Jason Spencer: Knowing just the # of dimensions won't tell me the total size or how to index. I need the size of each dimension. If you create such structs, you do what you want, so it represents a nD rectangular

Re: Can't get D calling C to build.

2010-08-26 Thread Philippe Sigaud
On Tue, Aug 24, 2010 at 15:24, Bob Cowdery b...@bobcowdery.plus.com wrote: I might be on my way :-) . Good :) I just skimmed through the thread, so I don't know if you're still using Code::Blocks. I'm using it, and it highlights D code with no problem. For 10.05, it's in Settings Editor

Re: easier way?

2010-08-26 Thread bearophile
Philippe Sigaud: What you lose is the CT checking that can be done for multiplication or additions if all dimensions are exposed in the type. If you want, you may create a second nD array struct where sizes too are CT values, plus two methods/free functions to convert between the two array

Re: Ways to initialize static arrays

2010-08-26 Thread Philippe Sigaud
On Thu, Aug 26, 2010 at 14:11, Stanislav Blinov bli...@loniir.ru wrote: Sorry, I pressed the wrong button so the message was sent to your email. Reciting: Does that work for you? Yes! Beautiful, thanks! That beats hell out of my clumsy templates :) Your templates are not clumsy, it's

Re: Ways to initialize static arrays

2010-08-26 Thread Stanislav Blinov
Philippe Sigaud wrote: That beats hell out of my clumsy templates :) Your templates are not clumsy, it's typically the way some other PL would process lists/arrays. I used to write a lot of these. But 6 months ago, CTFE got seven-leagues boots and right now it's much easier on the eye to

Re: easier way?

2010-08-26 Thread Philippe Sigaud
On Thu, Aug 26, 2010 at 22:41, bearophile bearophileh...@lycos.com wrote: Philippe Sigaud: What you lose is the CT checking that can be done for multiplication or additions if all dimensions are exposed in the type. If you want, you may create a second nD array struct where sizes too are