Re: Problem with object understanding and datatypes

2013-05-25 Thread Namal
Thank you very much, I thought the operators are alrdy checked by if (op == + || op == - || op == /) But I did same tests for ushort uint and ulong, but for ulong it didn't compile. unittest{ alias sulong = Saturated!ulong; assert(sulong(18_446_744_073_709_551_610) + sulong(2) ==

Re: Problem with object understanding and datatypes

2013-05-25 Thread bearophile
Namal: And if so, do I always have to use a suffix when the number is bigger than uint? It looks a bit silly, I agree. Bye, bearophile

Re: Problem with object understanding and datatypes

2013-05-25 Thread Namal
On Saturday, 25 May 2013 at 10:15:42 UTC, bearophile wrote: Namal: And if so, do I always have to use a suffix when the number is bigger than uint? It looks a bit silly, I agree. Bye, bearophile Well, now I have same Error for signed long: else{ static if (op == +){

Re: Problem with object understanding and datatypes

2013-05-25 Thread Ali Çehreli
On 05/25/2013 04:34 AM, Namal wrote: assert(slong(9_223_372_036_854_775_806) + slong(-3) == slong(-9_223_372_036_854_775_808)); } The first test is ok, but second wont even compile. Even if I append a L to each number. According to the Integer Literals section here:

Re: How to translate this C++ preprocessor declaration in D?

2013-05-25 Thread bearophile
Heinz: template makeId(char[4] id) { const makeId = id[0] 24 | id[1] 16 | id[2] 8 | id[3]; } const kPIHostBlendModeSignature = makeId!(8BIM); Generally it's more descriptive to use enum (or even a CT function): template makeId(char[4] id) { enum makeId = (id[0] 24) |

Re: Problem with object understanding and datatypes

2013-05-25 Thread Namal
Thanks, that helped me alot.

Mixin Templates Over-restricted?

2013-05-25 Thread yaz
Is there a reason for restricting mixin templates to only include declarations? For example, the following code doesn't work. (http://dpaste.dzfl.pl/1582a25e) Looking at the language specification (http://dlang.org/template-mixin.html) this doesn't seem to be an implementation limitation.

Re: Mixin Templates Over-restricted?

2013-05-25 Thread Diggory
On Saturday, 25 May 2013 at 18:05:01 UTC, yaz wrote: Is there a reason for restricting mixin templates to only include declarations? For example, the following code doesn't work. (http://dpaste.dzfl.pl/1582a25e) Looking at the language specification (http://dlang.org/template-mixin.html) this

Re: Mixin Templates Over-restricted?

2013-05-25 Thread yaz
On Saturday, 25 May 2013 at 18:28:09 UTC, Diggory wrote: I think you can do it using a string mixin instead: enum Test = `writeln(Hello D People!)` void main() { mixin(Test); } The answer to your question is probably that D has to know the context for a template mixing at the point where

Re: Mixin Templates Over-restricted?

2013-05-25 Thread John Colvin
On Saturday, 25 May 2013 at 18:28:09 UTC, Diggory wrote: D has to know the context for a template mixing at the point where it is declared rather than where it is used. Quite the opposite in fact. Templates exist in the context that they are defined in, mixin templates in the context where

Re: Problem with object understanding and datatypes

2013-05-25 Thread Namal
I have one more question towards using unsigned datatype assert(sint(-2_147_483_647) - sint(3) == sint(-2_147_483_648)); assert(sint(-2_147_483_647) - sint(3) == sint(2_147_483_648)); Here I get an error for the second line, because it cannot be convertet if i use unsigned

Linking etc.c.sqlite3 on Win32

2013-05-25 Thread Nick Sabalausky
Ok, uhhh...How do I do it? I did already grab http://www.sqlite.org/2013/sqlite-dll-win32-x86-3071700.zip which contains sqlite3.dll and sqlite3.def, FWIW.

Any examples of using inotify with D?

2013-05-25 Thread Gary Willoughby
Is there any examples of using inotify with D? http://en.wikipedia.org/wiki/Inotify I've updated the old tango header file and tried to get something working but it seems to hang. If anyone else has code using inotify i'd love to take a look to see how you have used it. ta.

Re: Linking etc.c.sqlite3 on Win32

2013-05-25 Thread Andrej Mitrovic
On 5/25/13, Nick Sabalausky seewebsitetocontac...@semitwist.com wrote: Ok, uhhh...How do I do it? Never used sqlite, but for implicit linking you need an import library which you then just pass to DMD at command-line. Use implib[1], probably with the /system switch on the DLL (or on the .def

Re: Linking etc.c.sqlite3 on Win32

2013-05-25 Thread Nick Sabalausky
On Sun, 26 May 2013 00:03:01 +0200 Andrej Mitrovic andrej.mitrov...@gmail.com wrote: On 5/25/13, Nick Sabalausky seewebsitetocontac...@semitwist.com wrote: Ok, uhhh...How do I do it? Never used sqlite, but for implicit linking you need an import library which you then just pass to DMD at

Re: Problem with object understanding and datatypes

2013-05-25 Thread Ali Çehreli
On 05/25/2013 11:57 AM, Namal wrote: I have one more question towards using unsigned datatype assert(sint(-2_147_483_647) - sint(3) == sint(-2_147_483_648)); assert(sint(-2_147_483_647) - sint(3) == sint(2_147_483_648)); Here I get an error for the second line, because it cannot be

more fun with ubuntu

2013-05-25 Thread Ellery Newcomer
I have a project here which fails on link on ubuntu 12.10. It give undefined reference errors for functions in libdl and libutil. For some reason, ld won't cooperate unless you pass -ldl -lutil at the end of the command string. Holy Ubuntu! I can't seem to get dmd to do this though. Any

Re: more fun with ubuntu

2013-05-25 Thread estew
On Sunday, 26 May 2013 at 05:01:10 UTC, Ellery Newcomer wrote: I have a project here which fails on link on ubuntu 12.10. It give undefined reference errors for functions in libdl and libutil. For some reason, ld won't cooperate unless you pass -ldl -lutil at the end of the command string.

Re: more fun with ubuntu

2013-05-25 Thread estew
Just to clarify: -I = flag to specify include path -L-L = flag to specify additional library search path -L-l = flag to specify link library /Stewart