A NOTE has been added to this issue. 
====================================================================== 
https://austingroupbugs.net/view.php?id=1647 
====================================================================== 
Reported By:                eblake
Assigned To:                
====================================================================== 
Project:                    1003.1(2016/18)/Issue7+TC2
Issue ID:                   1647
Category:                   System Interfaces
Type:                       Clarification Requested
Severity:                   Objection
Priority:                   normal
Status:                     Interpretation Required
Name:                       Eric Blake 
Organization:               Red Hat 
User Reference:             ebb.printf %lc 
Section:                    fprintf 
Page Number:                913 
Line Number:                30957 
Interp Status:              Proposed 
Final Accepted Text:        https://austingroupbugs.net/view.php?id=1647#c6239 
====================================================================== 
Date Submitted:             2023-03-28 16:32 UTC
Last Modified:              2023-06-29 11:28 UTC
====================================================================== 
Summary:                    printf("%lc", (wint_t)0) can't output NUL byte
======================================================================
Relationships       ID      Summary
----------------------------------------------------------------------
related to          0001643 fprintf %lc: wrong reference to the cur...
====================================================================== 

---------------------------------------------------------------------- 
 (0006369) geoffclare (manager) - 2023-06-29 11:28
 https://austingroupbugs.net/view.php?id=1647#c6369 
---------------------------------------------------------------------- 
> As it turns out, there is one other place that does say this is what is
intended: the description of CX "Extension to the ISO C standard"

The CX text is just giving information about statements that exist on other
pages. But thanks for pointing it out, because that text no longer matches
the statements it is referring to, and so needs adjusting. 

> I understand from your comments that your view is that when
_POSIX_C_SOURCE/_XOPEN_SOURCE is not defined, rather than deferring to ISO
C, the behaviour is undefined (unspecified?) in POSIX. [...] Is that a
correct interpretation of your comments?

Yes, it's undefined.  Anywhere POSIX requires confirming applications to do
something (such as the numerous places it says "The application shall
ensure that ..."), if an application doesn't do that thing then the
behaviour is undefined. I see no reason that this would not include the
requirement to define _POSIX_C_SOURCE or _XOPEN_SOURCE.

> If it is, the whole "Extension to the ISO C standard" is silly: there
cannot be even a single program that is both valid under ISO C and valid
under POSIX under your interpretation that includes any standard library
headers: if _POSIX_C_SOURCE/_XOPEN_SOURCE are defined, the behaviour is
undefined under ISO C, if _POSIX_C_SOURCE/_XOPEN_SOURCE are not defined,
the behaviour is undefined under POSIX. That does not extend ISO C in any
meaningful way.

It just means that conforming to ISO C and conforming to POSIX are two
independent choices that implementations can make. <b>If</b> an
implementation chooses to conform to both, then there will indeed be many
programs that are both valid under ISO C and valid under POSIX, and on such
implementations POSIX extends C. But implementations ought to be able to
choose to just support POSIX and not "bare C" if they want to.

> ISO C does not require the use of standard library headers

True, which means an implementation that wants to support both printf()
behaviours would not be able to choose between them based on whether
_POSIX_C_SOURCE/_XOPEN_SOURCE is defined. But there are other ways they
could do it (command line options and environment variables being the most
obvious).

> Note that if WG14 would be willing to classify this as a defect, that
avoids the entire issue.

That is indeed the root cause of this entire issue. WG14 are not issuing
DRs for C17, so we are forced to address C17 defects by saying that POSIX
does not defer to C17 for certain specific things.

I expect that in practice, implementations will treat the change in C23 as
being a de-facto DR for C17 and act accordingly. 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2023-03-28 16:32 eblake         New Issue                                    
2023-03-28 16:32 eblake         Name                      => Eric Blake      
2023-03-28 16:32 eblake         Organization              => Red Hat         
2023-03-28 16:32 eblake         User Reference            => ebb.printf %lc  
2023-03-28 16:32 eblake         Section                   => fprintf         
2023-03-28 16:32 eblake         Page Number               => 913             
2023-03-28 16:32 eblake         Line Number               => 30957           
2023-03-28 16:32 eblake         Interp Status             => ---             
2023-03-28 16:32 eblake         Relationship added       child of 0001643    
2023-03-28 16:33 eblake         Desired Action Updated                       
2023-03-28 17:02 eblake         Desired Action Updated                       
2023-03-28 17:30 eblake         Note Added: 0006237                          
2023-03-28 17:31 eblake         Description Updated                          
2023-03-28 17:37 eblake         Desired Action Updated                       
2023-03-30 16:33 eblake         Note Added: 0006239                          
2023-03-30 17:14 eblake         Tag Attached: tc3-2008                       
2023-03-30 17:14 eblake         Tag Attached: issue8                         
2023-04-03 15:27 eblake         Note Added: 0006246                          
2023-04-03 15:28 eblake         Note Edited: 0006239                         
2023-04-03 15:28 geoffclare     Tag Detached: tc3-2008                       
2023-04-03 15:31 ajosey         Interp Status            --- => Pending      
2023-04-03 15:31 ajosey         Final Accepted Text       =>
https://austingroupbugs.net/view.php?id=1647#c6239    
2023-04-03 15:31 ajosey         Resolution               Open => Accepted As
Marked
2023-04-03 15:32 ajosey         Status                   New => Interpretation
Required
2023-04-03 16:31 ajosey         Note Added: 0006248                          
2023-04-03 16:31 ajosey         Status                   Interpretation Required
=> Resolution Proposed
2023-04-03 16:46 hvd            Note Added: 0006251                          
2023-04-03 17:15 ajosey         Interp Status            Pending => Proposed 
2023-04-03 17:15 ajosey         Status                   Resolution Proposed =>
Interpretation Required
2023-04-20 16:22 geoffclare     Relationship replaced    related to 0001643  
2023-06-23 16:19 geoffclare     Note Added: 0006346                          
2023-06-23 16:45 hvd            Note Added: 0006347                          
2023-06-26 09:25 geoffclare     Note Added: 0006349                          
2023-06-26 09:56 hvd            Note Added: 0006350                          
2023-06-27 08:58 geoffclare     Note Added: 0006361                          
2023-06-27 12:29 geoffclare     Note Added: 0006365                          
2023-06-29 01:47 hvd            Note Added: 0006366                          
2023-06-29 02:01 hvd            Note Edited: 0006366                         
2023-06-29 11:28 geoffclare     Note Added: 0006369                          
======================================================================


  • [1003.1(2016... Austin Group Bug Tracker via austin-group-l at The Open Group
  • [1003.1(2016... Austin Group Bug Tracker via austin-group-l at The Open Group
  • [1003.1(2016... Austin Group Bug Tracker via austin-group-l at The Open Group
  • [1003.1(2016... Austin Group Bug Tracker via austin-group-l at The Open Group
  • [1003.1(2016... Austin Group Bug Tracker via austin-group-l at The Open Group
  • [1003.1(2016... Austin Group Bug Tracker via austin-group-l at The Open Group
  • [1003.1(2016... Austin Group Bug Tracker via austin-group-l at The Open Group
  • [1003.1(2016... Austin Group Bug Tracker via austin-group-l at The Open Group
  • [1003.1(2016... Austin Group Bug Tracker via austin-group-l at The Open Group
  • [1003.1(2016... Austin Group Bug Tracker via austin-group-l at The Open Group
  • [1003.1(2016... Austin Group Bug Tracker via austin-group-l at The Open Group
  • [1003.1(2016... Austin Group Bug Tracker via austin-group-l at The Open Group
  • [1003.1(2016... Austin Group Bug Tracker via austin-group-l at The Open Group
  • [1003.1(2016... Austin Group Bug Tracker via austin-group-l at The Open Group
  • [1003.1(2016... Austin Group Bug Tracker via austin-group-l at The Open Group

Reply via email to