[Rcpp-devel] FW: Rcpp attributes.cpp issue
Latchezar (Lucho) Dimitrov
ldimitro at wakehealth.edu
Sun Apr 19 06:54:23 CEST 2015
Hi Kevin,
Yes, your understanding was correct ☺. My problem is I cannot w/o going deep into the logic of the implementation to get the intent and from it the type to cast. I am afraid I have to ask you: Are you sure size_t is the type to cast in the context of attributes.cpp? Otherwise by intuition I replaced 0U with 0UL (equivalent I believe, to size_t) and it compiled.
In the lack of understanding are there any ways to check the correctness of so installed package Rcpp?
Thanks,
Latchezar
From: Kevin Ushey [mailto:kevinushey at gmail.com]
Sent: Saturday, April 18, 2015 11:15 PM
To: Latchezar (Lucho) Dimitrov
Cc: rcpp-devel at lists.r-forge.r-project.org
Subject: Re: [Rcpp-devel] FW: Rcpp attributes.cpp issue
IIUC, from the build errors you're seeing, the compiler can't decide if it should convert `0U` (unsigned int) to an `unsigned long` or a `char*` (e.g. as a null pointer). In other words, these two overloads are competing:
void insert (iterator p, size_t n, char c);
string& insert (size_t pos, size_t n, char c);
Most other standard library implementations have 'iterator' as a completely separate type from a plain `char*` pointer, to avoid things like this (since 0 can implicitly be converted to a pointer).
To work around this (on Rcpp's side) I think we could cast `0` to a `std::size_t` in each call, or else perform what is essentially a 'push_front' in a separate way.
Kevin
On Sat, Apr 18, 2015 at 7:02 PM, Latchezar (Lucho) Dimitrov <ldimitro at wakehealth.edu<mailto:ldimitro at wakehealth.edu>> wrote:
OK. Here it is.
Hi All,
Please see bellow my original e-mail to Mr. Eddelbuettel.
Help anyone? I do not need necessarily a Solaris user, rather someone who knows the actual types of 0U bellow or another way to resolve the ambiguity.
Thanks a lot,
Latchezar
"
Dear Mr. Eddelbuettel,
I have just built R-3.1.2 on solaris 11.2 with solaris stufio 12.4. Then starting it from the build I tried to install Rcpp. I failed due to the following compilation errors:
"attributes.cpp", line 1369: Error: Overloading ambiguity between "std::string::insert(char*, unsigned long, char)" and "std::string::insert(unsigned long, unsigned long, char)".
"attributes.cpp", line 1378: Error: Overloading ambiguity between "std::string::insert(char*, unsigned long, char)" and "std::string::insert(unsigned long, unsigned long, char)".
The lines in the code are:
typeText.insert(0U, 1U, *it);
and
name.insert(0U, 1U, ch);
Apparently I have to specify the type of 0U argument. Would you please help?
Thanks a lot,
Latchezar Dimitrov,
Analyst/Programmer, Wake Forest Univ. School of Medicine,
Winston-Salem, NC
U.S.A.
"
-----Original Message-----
From: Dirk Eddelbuettel [mailto:edd at debian.org<mailto:edd at debian.org>]
Sent: Saturday, April 18, 2015 10:15 AM
To: Latchezar (Lucho) Dimitrov
Cc: edd at debian.org<mailto:edd at debian.org>
Subject: Re: Rcpp attributes.cpp issue
I'd prefer the question on rcpp-devel. You may find a Solaris user there.
Dirk
Thank you for your email concerning Rcpp.
Due to the number of emails I receive about Rcpp, I can no longer respond to each incoming email individually. However, documentation is available via:
eight pdf "vignette" files which are included in the package, among them a
FAQ and an introduction to Rcpp
the introductory vignette is also published in the Journal of Statistical
Software (http://www.jstatsoft.org/v40/i08/)
my book at Springer (see http://www.rcpp.org/book) released in June 2013
about 80 examples published in the Rcpp Gallery (http://gallery.rcpp.org)
numerous answers on the rcpp-devel mailing list
(http://lists.r-forge.r-project.org/mailman/listinfo/rcpp-devel) and you are
invited to ask on the list (but need to subscribe first)
numerous posts on the StackOverflow site under the 'rcpp' tag
(http://stackoverflow.com/questions/tagged/rcpp) and you are invited to ask
there as well (though the rcpp-devel list may still get better answers)
posts on my blog (http://dirk.eddelbuettel.com/blog)
the code archive itself at GitHub https://github.com/RcppCore/Rcpp and the
package itself on CRAN (http://cran.r-project.org/web/packages/Rcpp/index.html),
in particular the unitTest examples can be instructive
the over 320 packages on CRAN (and 41 more on BioConductor) using Rcpp
Additionally, the introductory vignettes for RcppArmadillo and RcppEigen have now been published as well (http://dx.doi.org/10.1016/j.csda.2013.02.005;
http://www.jstatsoft.org/v52/i05/)
In particular, the rcpp-devel mailing list is the perfect place for questions (but please register in order to post, a measure required to keep spammers away).
Sincerely, Dirk Eddelbuettel
--
http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org<mailto:edd at debian.org>
_______________________________________________
Rcpp-devel mailing list
Rcpp-devel at lists.r-forge.r-project.org<mailto:Rcpp-devel at lists.r-forge.r-project.org>
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20150419/b2e40737/attachment-0001.html>
More information about the Rcpp-devel
mailing list