[PATCH] Make SIG2STR_MAX usable in #if

Torbjorn SVENSSON torbjorn.svensson@foss.st.com
Wed Jun 21 07:33:47 GMT 2023


  #if __SIZEOF_INT__ >= 4
-#define SIG2STR_MAX (sizeof("RTMAX+") + sizeof("4294967295") - 1)
+#define SIG2STR_MAX 21	/* (sizeof("RTMAX+") + sizeof("4294967295") - 1) */
  #else
-#define SIG2STR_MAX (sizeof("RTMAX+") + sizeof("65535") - 1)
+#define SIG2STR_MAX 17	/* (sizeof("RTMAX+") + sizeof("65535") - 1) */
  #endif


I have not read the specification, but how come it's 17 and 21?

 From what I can tell, "RTMAX+65535" is not 4 shorter than "RTMAX+4294967295".

Kind regards,
Torbjörn

On 2023-06-21 03:22, Mingye Wang wrote:
> On Mon, Jun 19, 2023 at 5:00 PM Corinna Vinschen <vinschen@redhat.com> wrote:
>>
>> We could redefine SIG2STR_MAX as static values (still dependent on
>> __SIZEOF_INT__) and prepend the sizeof expressions as comments.
>>
>> Do you want to provide a patch?
> 
> I guess? See the attached file for an attempt.
> 
> Uh, what license am I supposed to say I am releasing this patch under?
> 
> Sincerely,
> Mingye


More information about the Newlib mailing list