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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to