[Rcpp-devel] XPtr

Dominick Samperi djsamperi at gmail.com
Tue Jun 15 17:27:43 CEST 2010


This code seems simple enough (from cxxPack)...

RcppExport SEXP testBankOpen(SEXP name, SEXP id, SEXP balance) {
    BEGIN_RCPP
    BankAccount *p = new BankAccount(Rcpp::as<std::string>(name),
                     Rcpp::as<int>(id),
                     Rcpp::as<double>(balance));
    Rcpp::XPtr<BankAccount> xp(p, true);
    return xp;
    END_RCPP
}

Yet I get this from the Sun/Solaris compiler;

"/home/ripley/R/Lib32/Rcpp/include/Rcpp/XPtr.h", line 46: Warning: m_sexp
hides Rcpp::RObject::m_sexp.
"testBankAccount.cpp", line 35: Where: While instantiating
"Rcpp::XPtr<BankAccount>::XPtr(SEXPREC*, SEXPREC*, SEXPREC*)".
"testBankAccount.cpp", line 35: Where: Instantiated from non-template code.
"/home/ripley/R/Lib32/Rcpp/include/Rcpp/XPtr.h", line 180: Warning
(Anachronism): Formal argument fun of type extern "C" void(*)(SEXPREC*) in
call to R_RegisterCFinalizerEx(SEXPREC*, extern "C" void(*)(SEXPREC*),
Rboolean) is being passed void(*)(SEXPREC*).
"/home/ripley/R/Lib32/Rcpp/include/Rcpp/XPtr.h", line 174: Where: While
instantiating "Rcpp::XPtr<BankAccount>::setDeleteFinalizer()".
"/home/ripley/R/Lib32/Rcpp/include/Rcpp/XPtr.h", line 174: Where:
Instantiated from Rcpp::XPtr<BankAccount>::XPtr(BankAccount*, bool,
SEXPREC*, SEXPREC*).
"testBankAccount.cpp", line 25: Where: Instantiated from non-template code.

The same compiler warns when I wrap a std::vector<double>:

"/home/ripley/R/Lib32/Rcpp/include/Rcpp/traits/is_convertible.h", line 40:
Warning: A non-POD object of type "std::vector<double>" passed as a variable
argument to function "static
Rcpp::traits::is_convertible<std::vector<double>, SEXPREC*>::Test(...)".
"/home/ripley/R/Lib32/Rcpp/include/Rcpp/internal/wrap.h", line 510: Where:
While specializing "Rcpp::traits::is_convertible<std::vector<double>,
SEXPREC*>".
"/home/ripley/R/Lib32/Rcpp/include/Rcpp/internal/wrap.h", line 510: Where:
Instantiated from
Rcpp::internal::wrap_dispatch_unknown_importable<std::vector<double>>(const
std::vector<double>&, Rcpp::traits::integral_constant<bool, 0>).
"/home/ripley/R/Lib32/Rcpp/include/Rcpp/internal/wrap.h", line 527: Where:
Instantiated from Rcpp::internal::wrap_dispatch<std::vector<double>>(const
std::vector<double>&, Rcpp::traits::wrap_type_unknown_tag).
"/home/ripley/R/Lib32/Rcpp/include/Rcpp/internal/wrap.h", line 624: Where:
Instantiated from Rcpp::wrap<std::vector<double>>(const
std::vector<double>&).
"testFFT.cpp", line 29: Where: Instantiated from non-template code.

Odd thing about the last message is that there are two lines that do exactly
the same thing (wrap a std::vector<double>) but
the compiler issues a warning about only one of them.

Ideas?

Thanks,
Dominick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20100615/028692d9/attachment.htm>


More information about the Rcpp-devel mailing list