[Cfp-interest 1509] Re: Fw: Re: Question about strfromd in glibc

Mike Cowlishaw mfc at speleotrove.com
Thu Feb 20 05:29:53 PST 2020


Good to know!    I think I'll just stick to snprintf,all the same.  :-)
 
Mike


  _____  

From: cfp-interest-bounces at oakapple.net
[mailto:cfp-interest-bounces at oakapple.net] On Behalf Of Rajan Bhakta
Sent: 20 February 2020 02:05
To: CFP
Subject: [Cfp-interest 1507] Fw: Re: Question about strfromd in glibc


So it seems glibc does do the right thing (null terminate) and the web page
was wrong.

Regards,

Rajan Bhakta
z/OS XL C/C++ Compiler Technical Architect
ISO C Standards Representative for Canada, PL22.11 Chair (USA)
C Compiler Development
Contact: rbhakta at us.ibm.com, Rajan Bhakta/Houston/IBM
----- Forwarded by Rajan Bhakta/Houston/IBM on 02/19/2020 08:04 PM -----

From:        Joseph Myers <joseph at codesourcery.com>
To:        Rajan Bhakta <rbhakta at us.ibm.com>
Date:        02/19/2020 04:20 PM
Subject:        [EXTERNAL] Re: Question about strfromd in glibc

  _____  




On Wed, 19 Feb 2020, Rajan Bhakta wrote:

> Hi Joseph,
> 
> Looking at  <http://man7.org/linux/man-pages/man3/strfromd.3.html>
http://man7.org/linux/man-pages/man3/strfromd.3.html, it seems 
> to say you could end up with strings that are not null terminated. But 
> from the C standard draft (N2454 for example) it says that the strings are

> always null terminated and only that you may get incomplete (truncation 
> from the right) if 'n' is too small (yet still null terminated). Was this 
> an intentional decision or am I understanding the documentation wrong?

The strfrom functions are equivalent to particular calls to snprintf, so 
they should always null-terminate their output (when a nonzero size is 
specified).  The manpages are not official glibc documentation.

-- 
Joseph S. Myers
joseph at codesourcery.com





-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.oakapple.net/pipermail/cfp-interest/attachments/20200220/b98d18f0/attachment-0001.html 


More information about the Cfp-interest mailing list