Re: [R-pkg-devel] replacements of sprintf in compiled code

2023-01-21 Thread Dirk Eddelbuettel
On 21 January 2023 at 05:27, Duncan Murdoch wrote: | On 21/01/2023 5:15 a.m., Holger Hoefling wrote: | > Is there a simple replacement that I can use? | | You should use snprintf() which has an extra argument to state the size | of the buffer receiving the string. For example, | | char

Re: [R-pkg-devel] replacements of sprintf in compiled code

2023-01-21 Thread Bill Dunlap
Even Microsoft added snprintf to Visual C++ in 2015 (not that that matters for R). -Bill On Sat, Jan 21, 2023 at 2:47 AM Duncan Murdoch wrote: > On 21/01/2023 5:33 a.m., Holger Hoefling wrote: > > Hi, > > > > thanks for the tip! Is that available everywhere or do I need to set > > compiler

Re: [R-pkg-devel] replacements of sprintf in compiled code

2023-01-21 Thread Duncan Murdoch
On 21/01/2023 5:33 a.m., Holger Hoefling wrote: Hi, thanks for the tip! Is that available everywhere or do I need to set compiler requirements? You shouldn't need any special requirements. I think this was standardized in C99, which is supported by default in R. Not sure which C++

Re: [R-pkg-devel] replacements of sprintf in compiled code

2023-01-21 Thread Matthias Gondan
I think the function is more than 20 years old https://en.cppreference.com/w/c/io/fprintf Von: Holger Hoefling Gesendet: Samstag, 21. Januar 2023 11:37 An: Duncan Murdoch Cc: R Package Development Betreff: Re: [R-pkg-devel] replacements of sprintf in compiled code Hi, thanks for the tip

Re: [R-pkg-devel] replacements of sprintf in compiled code

2023-01-21 Thread Holger Hoefling
Hi, thanks for the tip! Is that available everywhere or do I need to set compiler requirements? Best Holger Hoefling On Sat, Jan 21, 2023 at 11:27 AM Duncan Murdoch wrote: > On 21/01/2023 5:15 a.m., Holger Hoefling wrote: > > Hi, > > > > In my recent re-submission with a bug-fix of the hdf5r

Re: [R-pkg-devel] replacements of sprintf in compiled code

2023-01-21 Thread Duncan Murdoch
On 21/01/2023 5:15 a.m., Holger Hoefling wrote: Hi, In my recent re-submission with a bug-fix of the hdf5r package, I got a new set of warnings from the compiler, one being that I shouldn't be using 'sprintf'. Is there a simple replacement that I can use? You should use snprintf() which has