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

2010-08-26 Thread Andrej Mitrovic
CB uses the Scintilla editing component, which is the one used by Scite (which I'm using atm). Scite was missing quite a bit of keywords, so I've added some of them. I just did a comparison, and it seems they're both missing a bunch of keywords. A fun thing to do is open CB and Scite side-by-si

Re: Ways to initialize static arrays

2010-08-26 Thread Stanislav Blinov
Philippe Sigaud wrote: I have an impression that syntax error is in order. Putting in second array and attempting similar initialization without commas leads to one. I've only tried it with Windows 2.048, though I think the front end would eat this on Linux too. Is this valid,

Re: easier way?

2010-08-26 Thread bearophile
Philippe Sigaud: > But in the same way that you cannot always convert T[] into T[3], how could > you convert a Tensor!(int,2) (2D, runtime dims) into a Matrix!(int,4,4)? > (2D, CT dim: 4*4) The conversion functions are written by you, so you can all things you want (with just few runtime tests).

Re: Ways to initialize static arrays

2010-08-26 Thread Philippe Sigaud
On Thu, Aug 26, 2010 at 23:49, Stanislav Blinov wrote: > struct S(T,size_t N) > { >T[N] arr; >int foo;// type doesn't seem to matter here, >// taking int for clarity > >static immutable S C1 = { initializeWith!(T,N)(0) 5 }; >// No

Re: easier way?

2010-08-26 Thread Philippe Sigaud
On Thu, Aug 26, 2010 at 22:41, bearophile 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 CT > values, plus t

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 us

Re: Ways to initialize static arrays

2010-08-26 Thread Philippe Sigaud
On Thu, Aug 26, 2010 at 14:11, Stanislav Blinov 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 typicall

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 ty

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 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 > Syntax Highlighting > sy

Re: easier way?

2010-08-26 Thread Philippe Sigaud
On Thu, Aug 26, 2010 at 03:50, bearophile 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 array. The total s

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: TDPL: Operator Overloading

2010-08-26 Thread Philippe Sigaud
On Wed, Aug 25, 2010 at 17:27, Andrej Mitrovic wrote: > 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 > function that would d

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: 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 i

Re: Debugging in D?

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

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 > > 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 fo

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: 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 tu