Re: Interesting C header translation problem

2014-08-08 Thread Petteri Aimonen via Digitalmars-d-learn
Hi, Honestly, I don't know. I would go stab the original API designers in the face and tell them to clean up their mess. I'm sorry to reply to a 2-year-old topic, but as the original API designer, I simply couldn't resist :) Please do not stab me in the face. The nanopb API was never

Re: getting autocompletion in emacs

2014-08-08 Thread Idan Arye via Digitalmars-d-learn
On Thursday, 7 August 2014 at 17:46:13 UTC, nikki wrote: I want to learn SDL2 and learn D at the same time, for the SDL2 part autocompletion would be very nice. I've found DCD but can't get it working (not finding symbols or declarations) at the moment but I was wondering if there are any

Re: D JSON (WAT?!)

2014-08-08 Thread Pavel via Digitalmars-d-learn
On Thursday, 24 July 2014 at 16:09:25 UTC, Justin Whear wrote: On Thu, 24 Jul 2014 16:04:01 +, Pavel wrote: Thanks to all you folks who explained in operator for me. My bad. Let's focus on the real problem, which is JSON wrapper class. Is it needed? Wouldn't it be better to get AA from

funny behavior of ..

2014-08-08 Thread seany via Digitalmars-d-learn
The .., range operator, when used like this : string a = abcd; string b = a[0 .. a.count()-1]; sets b to abc. is this the expected behavior?

Re: D JSON (WAT?!)

2014-08-08 Thread Justin Whear via Digitalmars-d-learn
On Fri, 08 Aug 2014 14:07:33 +, Pavel wrote: I know that as per JSON spec there's no boolean type specified, only separate true and false values, which are specified as type in http://dlang.org/library/std/json/JSON_TYPE.html, so I guess the only way to check boolean in JSONValue it is

Re: funny behavior of ..

2014-08-08 Thread Dominikus Dittes Scherkl via Digitalmars-d-learn
On Friday, 8 August 2014 at 15:17:25 UTC, seany wrote: The .., range operator, when used like this : string a = abcd; string b = a[0 .. a.count()-1]; sets b to abc. is this the expected behavior? Yes. [..] is exclusive the last element. So [0..1] is a single element [0] That allows to avoid

d malloc

2014-08-08 Thread seany via Digitalmars-d-learn
consider this : struct S { /* ... */ } void main() { ulong [] u; for(// ... { S s_instance; // fillup .. S.key = value; u ~= cast(ulong)*s_instance; } } however, the structs are being allocated to the same place. Because, Every time the iterator ends an

Re: d malloc

2014-08-08 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Aug 08, 2014 at 04:42:12PM +, seany via Digitalmars-d-learn wrote: consider this : struct S { /* ... */ } void main() { ulong [] u; for(// ... { S s_instance; // fillup .. S.key = value; u ~= cast(ulong)*s_instance; } } however,

Re: d malloc

2014-08-08 Thread seany via Digitalmars-d-learn
On Friday, 8 August 2014 at 16:51:37 UTC, H. S. Teoh via Digitalmars-d-learn wrote: On Fri, Aug 08, 2014 at 04:42:12PM +, seany via Digitalmars-d-learn wrote: consider this : struct S { /* ... */ } void main() { ulong [] u; for(// ... { S s_instance; // fillup ..

How to use Code::Block with D compiler ?

2014-08-08 Thread Borneq via Digitalmars-d-learn
I want use dmd compiler with COde:Blocks. IDE detect compiler but is error can't find compiler executable. I have Windows 8.1, CodeBlocks 13.12 (now svn 9790)

Command line compiler and libraries

2014-08-08 Thread Borneq via Digitalmars-d-learn
I download dmd.2.065.0.zip. I try compile hello.d with command line. It compiles when I have core/,std/ and rt/ directories in my directory. Compiler wants source files. Which option is to using libs?

Re: d malloc

2014-08-08 Thread anonymous via Digitalmars-d-learn
On Friday, 8 August 2014 at 17:07:37 UTC, seany wrote: And as discussed earlier, I was trying to save the pointers in an ulong (which is same as size_t or ptr_t, those are aliased) (when compiling for x86-64 that is) Generally, casting pointers to size_t is a horrible idea. Why can't you at

Re: Struct alignment vs alignment of fields

2014-08-08 Thread ketmar via Digitalmars-d-learn
p.s. seems that aligning works only on ints. i.e. on types which has sizeof = default platform align.

Re: Struct alignment vs alignment of fields

2014-08-08 Thread ketmar via Digitalmars-d-learn
yeah, chars (and bytes, and so on) are not aligned. i.e. align(1) struct B { int qtim; int bid; int ofr; int bidsiz; int ofrsiz; short mode; char ex; byte mmid; char z; } has sizeof == 25. not sure if specs mentions this, but they should.

Re: d malloc

2014-08-08 Thread ketmar via Digitalmars-d-learn
On Fri, 08 Aug 2014 16:42:12 + seany via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: a) we need the working code; b) foreach (a; ...) doest struct copying, and you see the temporary stack object as 'a'. either use 'ref a', or don't do that at all. that is what i was able to

Re: d malloc

2014-08-08 Thread seany via Digitalmars-d-learn
On Friday, 8 August 2014 at 17:44:29 UTC, anonymous wrote: On Friday, 8 August 2014 at 17:07:37 UTC, seany wrote: And as discussed earlier, I was trying to save the pointers in an ulong (which is same as size_t or ptr_t, those are aliased) (when compiling for x86-64 that is) Generally,

Re: d malloc

2014-08-08 Thread ketmar via Digitalmars-d-learn
Why are void pointers better than ulong, if I may ask there is at least one reason: GC. yes, it is conservative, but there's no reason to scan ulong[] for any pointers, so you may lost your objects if there is no other references to 'em.

Re: getting autocompletion in emacs

2014-08-08 Thread nikki via Digitalmars-d-learn
It was quite some journey I got it working now ;) https://github.com/Hackerpilot/DCD/issues/153

Are there desktop appications being developed in D currently?

2014-08-08 Thread Puming via Digitalmars-d-learn
Hi, I bumped into a blog talking about building a (toy) browser engine in Rust: (http://limpet.net/mbrubeck/2014/08/08/toy-layout-engine-1.html) In the blog I found that the OP is in the mozilla servo team building a parallel browser for mozilla. The servo is hosted on github here:

opDispatch compiles fine, but still fails to resolve?

2014-08-08 Thread Vlad Levenfeld via Digitalmars-d-learn
More opDispatch woes. This feature keeps biting me, yet I keep trying to use it. This time I'm trying to access elements of a vector GLSL-style (without swizzling... for now). Here's the relevant code: struct Vector (uint length, Element = double) { ref @property component

Re: Are there desktop appications being developed in D currently?

2014-08-08 Thread ed via Digitalmars-d-learn
On Saturday, 9 August 2014 at 00:34:43 UTC, Puming wrote: Hi, I bumped into a blog talking about building a (toy) browser engine in Rust: (http://limpet.net/mbrubeck/2014/08/08/toy-layout-engine-1.html) In the blog I found that the OP is in the mozilla servo team building a parallel

Re: opDispatch compiles fine, but still fails to resolve?

2014-08-08 Thread Meta via Digitalmars-d-learn
On Saturday, 9 August 2014 at 01:20:33 UTC, Vlad Levenfeld wrote: More opDispatch woes. This feature keeps biting me, yet I keep trying to use it. This time I'm trying to access elements of a vector GLSL-style (without swizzling... for now). Here's the relevant code: struct Vector (uint

Re: 'with(Foo):' not allowed, why?

2014-08-08 Thread timotheecour via Digitalmars-d-learn
On Wednesday, 6 August 2014 at 17:03:23 UTC, Timothee Cour via Digitalmars-d-learn wrote: Is there a reason why 'with(Foo):' is not allowed, and we have to use with(Foo){...} ? It would be more in line with how other scope definitions work (extern(C) etc) ping, anyone?

Re: Are there desktop appications being developed in D currently?

2014-08-08 Thread Puming via Digitalmars-d-learn
On Saturday, 9 August 2014 at 01:26:05 UTC, ed wrote: On Saturday, 9 August 2014 at 00:34:43 UTC, Puming wrote: Hi, I bumped into a blog talking about building a (toy) browser engine in Rust: (http://limpet.net/mbrubeck/2014/08/08/toy-layout-engine-1.html) In the blog I found that the OP

Re: Examples of Windows services in D?

2014-08-08 Thread Tyler Jensen via Digitalmars-d-learn
I am very interested to find a good example for D2 of a Windows Service implementation. Can you point me to one? On Saturday, 7 September 2013 at 13:57:07 UTC, HeiHon wrote: On Thursday, 23 February 2012 at 01:33:10 UTC, DNewbie wrote: Here is a simple service in D

Re: opDispatch compiles fine, but still fails to resolve?

2014-08-08 Thread Vlad Levenfeld via Digitalmars-d-learn
Yep, replacing @property with auto did the trick. The lack of error messages in opDispatch is frustrating. I realize that, due to tricks like __traits(compiles, Foo.testing_for_some_function), having opDispatch stop compilation if it fails is not going to work, but there's gotta be some way

Re: opDispatch compiles fine, but still fails to resolve?

2014-08-08 Thread H. S. Teoh via Digitalmars-d-learn
On Sat, Aug 09, 2014 at 05:34:40AM +, Vlad Levenfeld via Digitalmars-d-learn wrote: Yep, replacing @property with auto did the trick. The lack of error messages in opDispatch is frustrating. I realize that, due to tricks like __traits(compiles, Foo.testing_for_some_function), having