Re: Matrix creation quiz

2011-04-28 Thread Moritz Warning
On Thu, 28 Apr 2011 08:02:40 -0400, bearophile wrote: > A little quiz. This is related to a recent post of mine in the main D > newsgroup, but please don't take a look at that post yet. This is the > original function: uhm, very sneaky. I wonder, can there be done smth. on behalf of the language t

Re: toDelegate() for D1

2011-01-13 Thread Moritz Warning
On Thu, 13 Jan 2011 17:14:13 +, %u wrote: > == Quote from Simen kjaeraas (simen.kja...@gmail.com)'s article >> %u wrote: >> > I only need something to make a void deleg() from a void func(). >> This works for me: >> ReturnType!( F ) delegate( ParameterTypeTuple!( F ) ) toDelegate( F )( >> F f

Re: How to use tango's FileScan correctly?

2010-10-14 Thread Moritz Warning
Ok, as I've found out, FileScan is only for locating a set of files. the preferred way is to use the virtual file system (VFS): http://dsource.org/projects/tango/wiki/ChapterVFS Examples: http://www.dsource.org/projects/tango/wiki/VfsZipAndLinesExample http://dsource.org/projects/tango/browser/t

Re: How to use tango's FileScan correctly?

2010-10-14 Thread Moritz Warning
Here is the bug report (patch proposal included): http://dsource.org/projects/tango/ticket/2003 On Thu, 14 Oct 2010 15:31:47 +, qwesx wrote: > Hello! > > I'm trying out some things in D (with tango) and tried to build a *very* > primitive indexing program. One function requires to run throu

Re: How to use tango's FileScan correctly?

2010-10-14 Thread Moritz Warning
I suspect there is a bug. You could use FilePath.toList() as an alternative for now. foreach(path; FilePath(".").toList()) { if(path.isFolder) folder_counter++; else file_counter++; } On Thu, 14 Oct 2010 15:31:47 +, qwesx wrote: > Hello! > > I'm trying out some things in D (with

Re: Newsgroups, off-topic

2010-04-16 Thread Moritz Warning
On Fri, 16 Apr 2010 17:28:36 +0200, Joseph Wakeling wrote: > Lars T. Kyllingstad wrote: >> The D2 language, which has so far been the "experimental branch" of D >> and as such has been a rapidly moving target, is in its final stages of >> completion. The specification has more or less been frozen

Re: is pointer

2010-03-20 Thread Moritz Warning
On Fri, 19 Mar 2010 19:29:24 -0400, bearophile wrote: > (I am looking for rough corners in D, or in my knowledge of D.) [..] > > template IsPointer1(T) { > enum bool IsPointer1 = is(T : T*); > } > void main() { > int* ptr; > static assert(IsPointer1!(typeof(ptr))); // Err > } > > >

Re: why can't structs implement interfaces?

2009-11-24 Thread Moritz Warning
On Tue, 24 Nov 2009 21:55:02 +0100, Saaa wrote: > struct S : Pos {} > Why is this not possible? The struct would need an additional pointer for a dispatch table in case you want to have class semantics. If you only what a contract that certain functions are implemented, then it just need to be i

Re: FMOD working with Windows

2009-10-28 Thread Moritz Warning
On Wed, 28 Oct 2009 14:37:22 +1300, Joel Christensen wrote: > FMOD sound (record and play) is off D Programming web site. > http://wiki.dprogramming.com/FMod/HomePage > > I followed instructions from the web site. But one instruction said to > use 'coffimplib.exe' but I couldn't see where it is t

Re: Should I compare pointers with is of == ?

2009-10-14 Thread Moritz Warning
On Wed, 14 Oct 2009 08:15:01 -0400, #ponce wrote: > It's a bit unclear to me. > > I know I must compare references with is but pointers ? There is no difference because you can't overload the == operator etc. for pointers.

Re: Using OpenGL (custom port)

2009-10-04 Thread Moritz Warning
On Sun, 04 Oct 2009 19:52:12 -0400, David Butler wrote: [..] > Is there a difference between a pointer to a D array and an int* in C? > How do I convert between the two? Am I even looking in the right place? > You can think of a D array as a struct of a length value and a C pointer. struct Arr

Re: implicit ubyte casting

2009-10-02 Thread Moritz Warning
On Fri, 02 Oct 2009 16:25:01 +0200, Don wrote: > Brad Roberts wrote: >> On Thu, 1 Oct 2009, Saaa wrote: >> >>> I think is very bug-prone, isn't it obvious iub should be -5? >>> >>> ubyte ub = 5; >>> int iub = -ub; // iub now is 251 >>> >>> What is the reasoning to do it this way? >> >> The inclu

Re: implicit ubyte casting

2009-10-01 Thread Moritz Warning
On Thu, 01 Oct 2009 10:16:08 -0400, Jeremie Pelletier wrote: > Saaa wrote: >> I think is very bug-prone, isn't it obvious iub should be -5? >> >> ubyte ub = 5; >> int iub = -ub; // iub now is 251 >> >> What is the reasoning to do it this way? > > Minus toggles the most significant bit, be it on

Re: Access original data from array

2009-09-30 Thread Moritz Warning
On Thu, 01 Oct 2009 05:02:10 +0100, Tom S wrote: > Moritz Warning wrote: >> Hi, >> >> how can I access the original value for xs? [..] > > You were probably looking for the old meaning of .init, but it's gone > now, so I present these alternative fixes: >

Access original data from array

2009-09-30 Thread Moritz Warning
Hi, how can I access the original value for xs? I assume that xs is allocated at program start, because I don't get an access violation on gnu/linux when I reassign values. But how can I access the original value? Do I have to keep a copy before xs is modified? import tango.io.Stdout; void ma

Re: Why do I get stack overflow?

2009-05-24 Thread Moritz Warning
On Sun, 24 May 2009 20:49:53 -0300, Ary Borenszweig wrote: > When I compile this code I get "stack overflow" printed in the console. > Anyone know why? > > --- > int fact(int X)() { > if(X == 0) { > return 1; > } else { > int temp = fact!(X - 1)(); >

Re: client browser

2009-03-16 Thread Moritz Warning
On Mon, 16 Mar 2009 22:12:04 +, Nicholas Jordan wrote: > I don't get it, where's the pun? Googles Chrome browser spawns a process for each tab. This might not fit well here, but that's what came to my mind. :)

Re: client browser

2009-03-16 Thread Moritz Warning
On Mon, 16 Mar 2009 20:06:10 +, Nicholas Jordan wrote: > Google, latest. On WinXP service pack 2 New threads left and right indeed. :P Sorry for the pun.

Re: finding dmd.conf

2009-02-27 Thread Moritz Warning
On Fri, 27 Feb 2009 15:54:46 +0100, Lutger wrote: > I'm having some trouble with dmd.conf. I set up a (soft) symbolic link > to the dmd/bin path version I want to use, but dmd can't find > dmd.conf: > > $> which dmd > /home/lutger/code/bin/dmd/bin/dmd > $> dmd main.d > object.d: module object

Re: container class sample on Tango mainpage can not compile

2009-01-10 Thread Moritz Warning
On Wed, 07 Jan 2009 19:47:57 -0500, Sam Hu wrote: > Morning, > > Anybody can help? > > Regards, > Sam try this: auto nameSet=new TreeBag!(char[])(null, (char[] first,char[] second) { return icompare(first,second); } ); btw: tango.collection.* is deprecated and will be

Re: convert char[4] to uint at compile time

2008-12-23 Thread Moritz Warning
On Tue, 23 Dec 2008 13:16:28 +0300, Denis Koroskin wrote: > On Tue, 23 Dec 2008 11:07:08 +0300, Janderson wrote: > >> Moritz Warning wrote: >>> On Tue, 16 Dec 2008 19:54:11 +, BCS wrote: >>> >>>> Reply to Moritz, >>>> >>>>&g

Re: convert char[4] to uint at compile time

2008-12-23 Thread Moritz Warning
On Tue, 23 Dec 2008 00:07:08 -0800, Janderson wrote: > Moritz Warning wrote: >> On Tue, 16 Dec 2008 19:54:11 +, BCS wrote: >> >>> Reply to Moritz, >>> >>>> Hi, >>>> >>>> I have problems to convert a char[4] to an uint at co

Re: convert char[4] to uint at compile time

2008-12-16 Thread Moritz Warning
On Tue, 16 Dec 2008 19:54:11 +, BCS wrote: > Reply to Moritz, > >> Hi, >> >> I have problems to convert a char[4] to an uint at compile time. All >> variations (I've tried) of using an enum crashes dmd: >> >> union pp { char[4] str; uint num; } >> const uint x = pp("abcd").num >> This does

convert char[4] to uint at compile time

2008-12-16 Thread Moritz Warning
Hi, I have problems to convert a char[4] to an uint at compile time. All variations (I've tried) of using an enum crashes dmd: union pp { char[4] str; uint num; } const uint x = pp("abcd").num This does also doesn't work: const uint x = cast(uint) x"aa aa aa aa"; Any ideas?