tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: printf(1), sh(1), POSIX.2 and octal escape sequences



Le Wed, Jun 28, 2023 at 12:45:55PM -0400, Mouse a écrit :
> >>> "\ddd", where ddd is a one, two, or three-digit octal number, shall
> >>> be written as a byte with the numeric value specified by the octal
> >>> number."
> >> [...]
> > I beg to differ: since due to this very unfortunate "variable length"
> > feature, your scanner has to read char by char, it can reject the
> > third digit since it would yield an out of range byte value.
> 
> Would it?  Only if your bytes are smaller than nine bits - or if
> they're signed and smaller than ten bits.
> 
> Is the size of a `byte' specified anywhere?

From memory, in POSIX a char is a byte (8bit) representable value (it
may be implemented with a wider size, but only this range is valid).
-- 
        Thierry Laronde <tlaronde +AT+ polynum +dot+ com>
                     http://www.kergis.com/
                    http://kertex.kergis.com/
Key fingerprint = 0FF7 E906 FBAF FE95 FD89  250D 52B1 AE95 6006 F40C


Home | Main Index | Thread Index | Old Index