A NOTE has been added to this issue. 
====================================================================== 
http://austingroupbugs.net/view.php?id=1138 
====================================================================== 
Reported By:                joerg
Assigned To:                
====================================================================== 
Project:                    1003.1(2016)/Issue7+TC2
Issue ID:                   1138
Category:                   System Interfaces
Type:                       Enhancement Request
Severity:                   Editorial
Priority:                   normal
Status:                     New
Name:                       Jörg Schilling 
Organization:                
User Reference:              
Section:                    System Interfaces 
Page Number:                new interface 
Line Number:                newinterface 
Interp Status:              --- 
Final Accepted Text:         
====================================================================== 
Date Submitted:             2017-04-27 12:02 UTC
Last Modified:              2017-04-27 15:47 UTC
====================================================================== 
Summary:                    Add strsignal(), sig2str() and str2sig() to the
standard.
====================================================================== 

---------------------------------------------------------------------- 
 (0003681) kre (reporter) - 2017-04-27 15:47
 http://austingroupbugs.net/view.php?id=1138#c3681 
---------------------------------------------------------------------- 
Re (note 3680)
    In order to ad a new interface, there should be a need for that
interface

Quite correct, but "I believe" is not evidence of that.   The way to do it
is
to actually implement the interface, and have it actually used (as note
3679
suggests).

That way we get some real evidence that the interface proposed is the
correct
one.

For example, I wouldn't implement either of the 2 proposed new functions
with
the function prototype you gave, for me it would be ...

int str2sig(const char *s) signal name -> signal number

int sig2str(int i, char *s, size_t len) signal number -> signal name

(and that still leaves aside the choice of names, str_to_sig() (etc) would
be another possibility - but with naming it tends to be whatever becomes
popular first, as there is no one right answer.)

For str2sig() a return value of 0 would indicate an error (no such sig
name)
as the one thing we know about signal numbers is that 0 is not one of
them.

And for sig2str() we need a buffer length arg, as while we might "just
know"
that SIG2STR_MAX is sufficient, implementing things that way means that
there's no possibility to ever increase that value (or binary compat/safety
is
lost.)   The constant can still exist, but it should just be for users to
size
the buffer, not for the internals of the function to use.

But all of this is just my opinion, the only way we ever really know what
works is for users to use the interface, and be happy enough that they use
it (not just reinvent it) and don't keep asking for changes. 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2017-04-27 12:02 joerg          New Issue                                    
2017-04-27 12:02 joerg          Name                      => Jörg Schilling 
2017-04-27 12:02 joerg          Section                   => System Interfaces
2017-04-27 12:02 joerg          Page Number               => new interface   
2017-04-27 12:02 joerg          Line Number               => newinterface    
2017-04-27 12:11 joerg          Note Added: 0003678                          
2017-04-27 13:32 schwarze       Note Added: 0003679                          
2017-04-27 14:15 joerg          Note Added: 0003680                          
2017-04-27 15:47 kre            Note Added: 0003681                          
======================================================================


Reply via email to