Re: Covert a complex C header to D

2017-04-05 Thread Nicholas Wilson via Digitalmars-d-learn
On Wednesday, 5 April 2017 at 12:27:23 UTC, biocyberman wrote: On Monday, 3 April 2017 at 23:10:49 UTC, Stefan Koch wrote: On Monday, 3 April 2017 at 11:18:21 UTC, Nicholas Wilson wrote: prefer template over string mixins where possible. This will make the code much more readable. My

Re: Covert a complex C header to D

2017-04-05 Thread biocyberman via Digitalmars-d-learn
On Monday, 3 April 2017 at 23:10:49 UTC, Stefan Koch wrote: On Monday, 3 April 2017 at 11:18:21 UTC, Nicholas Wilson wrote: prefer template over string mixins where possible. This will make the code much more readable. My advise would be the opposite. templates put much more pressure on

Re: Covert a complex C header to D

2017-04-04 Thread Ali Çehreli via Digitalmars-d-learn
On 04/02/2017 02:43 PM, biocyberman wrote: > khash.h > (http://attractivechaos.github.io/klib/#Khash%3A%20generic%20hash%20table) > is a part of klib library in C. I want to covert it to D in the process > of learning deeper about D. These are macros used by the library developer to generate

Re: Covert a complex C header to D

2017-04-03 Thread Stefan Koch via Digitalmars-d-learn
On Monday, 3 April 2017 at 11:18:21 UTC, Nicholas Wilson wrote: prefer template over string mixins where possible. This will make the code much more readable. My advise would be the opposite. templates put much more pressure on the compiler then string-mixins do. Also the code that

Re: Covert a complex C header to D

2017-04-03 Thread Nicholas Wilson via Digitalmars-d-learn
On Monday, 3 April 2017 at 10:04:53 UTC, biocyberman wrote: On Monday, 3 April 2017 at 00:00:04 UTC, Nicholas Wilson wrote: On Sunday, 2 April 2017 at 21:43:52 UTC, biocyberman wrote: template __KHASH_TYPE(string name){ "struct kh_" ~ name ~"_t { " ~ "khint_t n_buckets,

Re: Covert a complex C header to D

2017-04-03 Thread biocyberman via Digitalmars-d-learn
On Monday, 3 April 2017 at 00:00:04 UTC, Nicholas Wilson wrote: On Sunday, 2 April 2017 at 21:43:52 UTC, biocyberman wrote: template __KHASH_TYPE(string name){ "struct kh_" ~ name ~"_t { " ~ "khint_t n_buckets, size, n_occupied, upper_bound; " ~ "khint32_t

Re: Covert a complex C header to D

2017-04-02 Thread Nicholas Wilson via Digitalmars-d-learn
On Sunday, 2 April 2017 at 21:43:52 UTC, biocyberman wrote: template __KHASH_TYPE(string name){ "struct kh_" ~ name ~"_t { " ~ "khint_t n_buckets, size, n_occupied, upper_bound; " ~ "khint32_t *flags; " ~ "khkey_t *keys; " ~

Re: Covert a complex C header to D

2017-04-02 Thread Nicholas Wilson via Digitalmars-d-learn
On Sunday, 2 April 2017 at 21:43:52 UTC, biocyberman wrote: khash.h (http://attractivechaos.github.io/klib/#Khash%3A%20generic%20hash%20table) is a part of klib library in C. I want to covert it to D in the process of learning deeper about D. First I tried with Dstep

Covert a complex C header to D

2017-04-02 Thread biocyberman via Digitalmars-d-learn
khash.h (http://attractivechaos.github.io/klib/#Khash%3A%20generic%20hash%20table) is a part of klib library in C. I want to covert it to D in the process of learning deeper about D. First I tried with Dstep (https://github.com/jacob-carlborg/dstep) and read the C to D article