[Rd] defines in Rmath.h and R_NO_REMAP

Daniel Sabanés Bové daniel.sabanesbove at campus.lmu.de
Mon Oct 13 14:09:15 CEST 2008


Dear Prof. Ripley,

thank you for the pointer to #undef;
I used it the first time now and put

// undo Rmath.h madness ;-)
#ifdef beta
#undef beta
#endif

in my (templates) header file. It works, and it is much
nicer than my forwarding functions.

Prof Brian Ripley schrieb:
> If you read the 'Writing R Extensions' manual it only mentions
R_NO_REMAP in conjuction with Rinternals.h and R_ext/Error.h.
>
> So yes, it is intentional that it does not work for Rmath.h.  If you
would like it to, remember we often say 'patches will be considered'. 
But see the inline comment below.
>
> On Sat, 11 Oct 2008, Daniel Sabanés Bové wrote:
>
> Hi,
>
> I'm programming with R 2.7.2 and had some trouble including
> Rmath.h for its random variates generation routines: Although
> I define R_NO_REMAP (which works fine for Rinternals.h stuff),
> Rmath.h defines "beta" as "Rf_beta" etc., so that my "beta" strings
> get redefined as well! Is this a feature?
>
> I found an old Rmath.h version from 2000,
> which seems to obey the R_NO_REMAP flag, but the present version
> only obeys the math library standalone flag and ignores R_NO_REMAP.
>
> As a bad workaround I defined some forwarding functions and
> included Rmath.h in a separate part of the code... but this is not
> very beautiful.
>
> > You could just #undef beta !
>
> Thanks,
> Daniel
>>
______________________________________________
R-devel at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
>>



More information about the R-devel mailing list