Re: [R-pkg-devel] Canonical way to Rprintf R_xlen_t

2023-11-28 Thread Tomas Kalibera
On 11/28/23 22:21, Tomas Kalibera wrote: On 11/28/23 21:50, Henrik Bengtsson wrote: Daniel, I get those compiler warnings for '%td" MS Windows. It works fine on Linux. Please let me clarify. %td works in R on Windows in R 4.3 and R-devel, when using the recommended toolchain, which is

Re: [R-pkg-devel] Canonical way to Rprintf R_xlen_t

2023-11-28 Thread Tomas Kalibera
On 11/28/23 21:55, Daniel Kelley wrote: I hope it's okay to ask this on the present thread, rather than starting a new one... On this issue of the C format for various integer-type items, I am finding that checks made with devtools::check_win_devel() give different results than those made

Re: [R-pkg-devel] Canonical way to Rprintf R_xlen_t

2023-11-28 Thread Tomas Kalibera
On 11/28/23 20:51, Ivan Krylov wrote: On Wed, 29 Nov 2023 06:11:23 +1100 Hugh Parsonage wrote: Rprintf("%lld", (long long) xlength(x)); This is fine. long longs are guaranteed to be at least 64 bits in size and are signed, just like lengths in R. Right, this has been my choice for R-devel,

Re: [R-pkg-devel] Canonical way to Rprintf R_xlen_t

2023-11-28 Thread Tomas Kalibera
On 11/28/23 21:50, Henrik Bengtsson wrote: Daniel, I get those compiler warnings for '%td" MS Windows. It works fine on Linux. Please let me clarify. %td works in R on Windows in R 4.3 and R-devel, when using the recommended toolchain, which is Rtools43. It also worked with R 4.2 and

Re: [R-pkg-devel] Canonical way to Rprintf R_xlen_t

2023-11-28 Thread Daniel Kelley
I hope it's okay to ask this on the present thread, rather than starting a new one... On this issue of the C format for various integer-type items, I am finding that checks made with devtools::check_win_devel() give different results than those made with the github R-CMD-check action named

Re: [R-pkg-devel] Canonical way to Rprintf R_xlen_t

2023-11-28 Thread Henrik Bengtsson
Daniel, I get those compiler warnings for '%td" MS Windows. It works fine on Linux. FYI, https://builder.r-hub.io/ is a great, free service for testing on various platforms in the cloud. Also, if you host your package code on GitHub, it's a small step to configure GitHub Actions to check your

Re: [R-pkg-devel] Canonical way to Rprintf R_xlen_t

2023-11-28 Thread Daniel Kelley
To HB: I also maintain a package that has this problem. I do not have access to a linux machine (or a machine with the C++ version in question) so I spent quite a while trying to get docker set up. That was a slow process because I had to install R, a bunch of packages, some other software,

Re: [R-pkg-devel] Canonical way to Rprintf R_xlen_t

2023-11-28 Thread Reed A. Cartwright
If I have read the R's change log correctly, C99 printf format is now supported on Windows. I think the change was made in the last week. On Tue, Nov 28, 2023, 13:01 Henrik Bengtsson wrote: > "%td" is not supported on all platforms/compilers. This is what I got > when I added it to

Re: [R-pkg-devel] Canonical way to Rprintf R_xlen_t

2023-11-28 Thread Henrik Bengtsson
"%td" is not supported on all platforms/compilers. This is what I got when I added it to 'matrixStats'; * using log directory 'D:/a/matrixStats/matrixStats/check/matrixStats.Rcheck' * using R Under development (unstable) (2023-11-26 r85638 ucrt) * using platform: x86_64-w64-mingw32 * R was

Re: [R-pkg-devel] Canonical way to Rprintf R_xlen_t

2023-11-28 Thread Ivan Krylov
On Wed, 29 Nov 2023 06:11:23 +1100 Hugh Parsonage wrote: > Rprintf("%lld", (long long) xlength(x)); This is fine. long longs are guaranteed to be at least 64 bits in size and are signed, just like lengths in R. > Rprintf("%td, xlength(x)); Maybe if you cast it to ptrdiff_t first. Otherwise I

Re: [R-pkg-devel] Canonical way to Rprintf R_xlen_t

2023-11-28 Thread Reed A. Cartwright
If you want to future proof your code, the first or third is the way to go. However, I prefer '%td' for readability. If R ever changes how R_xlen_t is defined, I assume the checks will alert me to the need to change the format string. On Tue, Nov 28, 2023, 12:12 Hugh Parsonage wrote: > Hello,

[R-pkg-devel] Canonical way to Rprintf R_xlen_t

2023-11-28 Thread Hugh Parsonage
Hello, I've been asked to update my package which contains numerous instances of Rprintf("%lld", xlength(x)); that is, erroneously using %lld for objects of type R_xlen_t. Having searched for the correct way, I seem to have come across 3 competing approaches: Rprintf("%lld", (long long)

Re: [R-pkg-devel] NOTE or Information?

2023-11-28 Thread Lionel Henry
I need to do an rlang release for the same format warning! I'll take this opportunity to look into conditionally exporting `%||%` from base, which should solve that warning. Best, Lionel On 11/28/23, Göran Broström wrote: > A thirty-year-old format error in the C code of my package eha was >

Re: [R-pkg-devel] NOTE or Information?

2023-11-28 Thread Ivan Krylov
В Tue, 28 Nov 2023 13:40:51 +0100 Göran Broström пишет: > I guess that this is a result of my use of devtools and roxygen for > writing documentation. Is this a bug in rlang and the mask part of > the message will go away when it is fixed? Not exactly a bug. It just so happens that rlang

Re: [R-pkg-devel] NOTE or Information?

2023-11-28 Thread Enrico Schumann
On Tue, 28 Nov 2023, Göran Broström writes: > A thirty-year-old format error in the C code of my > package eha was finally detected by the latest R-devel, > thanks to CRAN for that! > > However, I also get a message never seen before, when I check the package: > >

[R-pkg-devel] NOTE or Information?

2023-11-28 Thread Göran Broström
A thirty-year-old format error in the C code of my package eha was finally detected by the latest R-devel, thanks to CRAN for that! However, I also get a message never seen before, when I check the package: --- Attaching package: ‘rlang’ The