[Rd] C++ complains abouct Rprintf signature
Prof Brian Ripley
ripley at stats.ox.ac.uk
Wed Apr 16 22:07:37 CEST 2008
Please see the posting guide:
For questions about unexpected behavior or a possible bug, you should,
at a minimum, copy and paste the output from sessionInfo() into
your message.
...
If you are using an old version of R and think it does not work
properly, upgrade to the latest version and try that, before posting.
If possible, try the current R-patched or R-devel version of R
(see the FAQ for details), to see if the problem has already
been addressed.
It has ....
On Wed, 16 Apr 2008, Vadim Organovich wrote:
> Dear R-devel,
>
> My g++ complains about the first argument to Rprintf being non-const char *. For example when compiling the line
>
> Rprintf("hello world\n");
>
> the following warning is emitted:
> warning: deprecated conversion from string constant to 'char*'
>
>
>
> Is there a reason for the non-const? It is curious that Rf_error, which is similar to RPrintf, is const.
>
>
>
> If there is a need to keep it non-const in C please consider using the patch below in future releases.
>
>
>
> Thanks,
>
> Vadim
>
> Patch to R-2.6.1/include/R_ext/Print.h
>
> #ifdef __cplusplus
> extern "C" {
> #define CONST const
> #endif
> void Rprintf(CONST char *, ...);
> void REprintf(CONST char *, ...);
> void Rvprintf(const char *, va_list);
> void REvprintf(const char *, va_list);
> #ifdef __cplusplus
> }
> #undef CONST
> #endif
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-devel
mailing list