Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220503171427.GW7074@brightrain.aerifal.cx>
Date: Tue, 3 May 2022 13:14:27 -0400
From: Rich Felker <dalias@...c.org>
To: Jeffrey Walton <noloader@...il.com>
Cc: musl@...ts.openwall.com, Jules Maselbas <jmaselbas@...ray.eu>
Subject: Re: [PATCH 2/2] Remove trailing whitespaces tree-wide

On Tue, May 03, 2022 at 12:17:59PM -0400, Jeffrey Walton wrote:
> One unrelated comment... The code below is not portable. There's no

Code that's part of the implementation is "not portable" ... to other
implementations?

musl defines that the character encoding is UTF-8. Aside from that,
that the character encoding is UTF-8 should not even be a question in
2022.

> guarantee the fifth bit is set to differentiate between upper and
> lower alphabetic characters.
> 
> >         if ((t|32)=='g') {
> >                 if (!p) p++;
> >                 if (p>e && e>=-4) {
> 
> Musl should probably use tolower instead.

If you're allowing for arbitrary changes to the character encoding and
properties, then tolower is even worse. A locale could define tolower
to whatever it wants and then printf would have nonconforming
behavior. The only "more portable" choice is t=='g' || t=='G'.

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.