Re: [R-pkg-devel] Check warning around sprintf: Compiled code should not call entry points which might terminate R nor write to stdout/stderr instead of to the console, nor use Fortran I/O nor system

2023-11-20 Thread Iago Giné-Vázquez
Thanks to all for the inputs and Ivan and Martin for the cleaner code you suggest and which I will definitely use. Iago Sent with Proton Mail secure email. On Monday, 20 November 2023 at 10:09, Martin Maechler wrote: > > > > > > Serguei Sokol > > > > > > on Mon, 20 Nov 2023 10:04:10

Re: [R-pkg-devel] Check warning around sprintf: Compiled code should not call entry points which might terminate R nor write to stdout/stderr instead of to the console, nor use Fortran I/O nor system

2023-11-20 Thread Martin Maechler
> Serguei Sokol > on Mon, 20 Nov 2023 10:04:10 +0100 writes: > Le 19/11/2023 à 02:07, Iris Simmons a écrit : >> Yes, the reason for the error is the use of sprintf. You can instead use >> snprintf where n is the maximum number of bytes to write, including the >>

Re: [R-pkg-devel] Check warning around sprintf: Compiled code should not call entry points which might terminate R nor write to stdout/stderr instead of to the console, nor use Fortran I/O nor system

2023-11-20 Thread Iris Simmons
The n in snprintf includes the room for the terminating nul. It should be 8191. If gcc is throwing a warning, it can be ignored. On Mon, Nov 20, 2023, 04:04 Serguei Sokol wrote: > Le 19/11/2023 à 02:07, Iris Simmons a écrit : > > Yes, the reason for the error is the use of sprintf. You can

Re: [R-pkg-devel] Check warning around sprintf: Compiled code should not call entry points which might terminate R nor write to stdout/stderr instead of to the console, nor use Fortran I/O nor system

2023-11-20 Thread Serguei Sokol
Le 19/11/2023 à 02:07, Iris Simmons a écrit : Yes, the reason for the error is the use of sprintf. You can instead use snprintf where n is the maximum number of bytes to write, including the terminating nul character. For example: char msg[8191]; snprintf(msg, 8191, "criteria: error (%d) ->