[Rcpp-devel] Rcpp::ListOf.size() returns signed int?

Kevin Ushey kevinushey at gmail.com
Tue Sep 2 07:13:02 CEST 2014


Hi Christian,

Thanks for catching this. I think this is an oversight -- this should
return `R_len_t` as well. Or, when long vector support is implemented,
`R_xlen_t` should be used instead (especially since `ListOf<T>` is
more-or-less a fancy interface over a `List` object)

Just pushed a corresponding change to master on Rcpp:
https://github.com/RcppCore/Rcpp/commit/0da625a34269191d1683b2edb537d3537367c681

Thanks,
Kevin

On Mon, Sep 1, 2014 at 9:01 PM, Christian Gunning <xian at unm.edu> wrote:
> Minor implementation question -
> As a learning exercise, I'm working through g++ warnings.  After
> reading SO posts r.e. int vs size_t, I've set all variables that hold
> or compare object size information to type std::size_t.  This fixes
> compiler warnings for Vector.size(), which doxygen shows have return
> type
> R_len_t.  ListOf.size() appears the odd man out, returning int.  Is
> there a reason ListOf.size() returns a (signed) int?
>
> Thanks,
> Christian
>
> Ref:
> ListOf.size(): http://dirk.eddelbuettel.com/code/rcpp/html/classRcpp_1_1ListOf.html#a610d059eca87928f6b3ae80dec75f817
>
> Vector.size(): http://dirk.eddelbuettel.com/code/rcpp/html/classRcpp_1_1Vector.html#a8d003a52136223a30c942a75cf629b0a
> _______________________________________________
> Rcpp-devel mailing list
> Rcpp-devel at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel


More information about the Rcpp-devel mailing list