[Rcpp-devel] Rprintf equivalent for std::cout ?

Steffen Neumann sneumann at ipb-halle.de
Sun Nov 11 17:34:35 CET 2012


I am not certain the question in the subject 
is grammatically correct. Nevertheless, R and Bioconductor 
are more and more complaining about symbols it doesn't like [1],
such as printf, exit, std::cerr or std::cout. 

While the former are rather simple to search&replace 
with Rprintf or something equivalent, I am looking for Rcpp streams
which are the equivalent to cout and cerr, e.g.

	Rcpp::rout << "Hi world" << std::endl;
or	Rcpp::rerr << "Damn, s**t hit the fan!" << std::endl;

I need that if I want to wrap 3rd party source code
that was not written with being part of an R library 
in first place. Boost stuff comes to mind here ...

I'd love to be able to 
find . -type f -exec sed -i -e 's/std::cerr/Rcpp::rerr/g' \{\} \;
to fix that. Or did I miss anything obvious ?


P.S.: can the C preprocessor handle the replacement, 
      i.e. something like c++ -Dstd::cout=Rcpp::rout ?

[1] http://bioconductor.org/checkResults/2.12/bioc-LATEST/mzR/lamb2-checksrc.html

IPB Halle                    AG Massenspektrometrie & Bioinformatik
Dr. Steffen Neumann          http://www.IPB-Halle.DE
Weinberg 3                   http://msbi.bic-gh.de
06120 Halle                  Tel. +49 (0) 345 5582 - 1470
                                  +49 (0) 345 5582 - 0
sneumann(at)IPB-Halle.DE     Fax. +49 (0) 345 5582 - 1409

More information about the Rcpp-devel mailing list