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 *flags; " ~
                "khkey_t *keys; " ~
                "khval_t *vals; " ~
        "}"

}

Not that you'll get bitten by it in this case but in D the pointer declarator * is left associative.

i.e. in C

 int *pInt, Int; // "Int" is int not an int*
 int *pInt, Int[3]; // Int is a static array of 3 ints.
but in D

misleading:
 int *pInt, Int; // Int is an int*!!

wrong:
 int *pInt, three_Ints[3]; // Error cannot mix declared types

not misleading
int* pInt, pInt2; // BOTH int*

int*pInt; //pointer to int
int[3] three_Ints; // static array of 3 ints.

Thank you for some excellent tips, Nicholas Wilson. I made this repo https://github.com/biocyberman/klibD. You are more than welcome to make direct contributions with PRs there. The next milestone want to reach is to complete to conversion of khash.d and have to test code with it.

Reply via email to