noob in c macro preprocessor hell converting gsl library header files
data pulverizer via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Jan 6 06:49:51 PST 2016
On Wednesday, 6 January 2016 at 13:59:44 UTC, John Colvin wrote:
>> #define INLINE_FUN extern inline // used in gsl_pow_int.h:
>> INLINE_FUN double gsl_pow_2(const double x) { return x*x; }
>>
>> Could I just ignore the INLINE_FUN and use alias for function
>> pointer declaration? For example ...
>>
>> alias gsl_pow_2 = double gsl_pow_2(const(double) x);
>
> Yes, you should be able to ignore INLINE_FUN
>
> double gsl_pow_2(const double x);
>
> is the correct declaration.
>
>> #define GSL_VAR extern // used in rng/gsl_rng.h:GSL_VAR const
>> gsl_rng_type *gsl_rng_borosh13;
>>
>> perhaps GSL_VAR can be ignored and I could use:
>>
>> gsl_rng_borosh13 const(gsl_rng_type)*;
>
> It should be
>
> extern gsl_rng_type* gsl_rng_borosh13;
I see. Thanks.
> I think you might have some confusion between function
> declarations:
>
> T myFunction(Q myArg);
>
> function pointer type declarations:
>
> alias MyFunctionPointerType = T function(Q myArg);
>
> and function pointer declarations:
>
> MyFunctionPointerType myFunctionPointer;
Sorry in my haste to describe what I was doing I wrote down a
function pointer instead of a function - my original code was a
function. Your suggestion of looking at the
https://github.com/abrown25/gsld library is a good call. I'll
probably end up sending a pull request to that library after
using it as a basic outline of how to deal with these
preprocessors.
More information about the Digitalmars-d-learn
mailing list