:: Re: [DNG] [OT] [Re: Studying C as t…
Pàgina inicial
Delete this message
Reply to this message
Autor: Adam Borowski
Data:  
A: dng
Assumpte: Re: [DNG] [OT] [Re: Studying C as told. (For help)
On Tue, Jun 21, 2016 at 03:13:21PM +0200, Irrwahn wrote:
> On Tue, 21 Jun 2016 14:42:46 +0200, Edward Bartolo wrote:
> [...]
> >     if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) {
> [...]
> You should *never* assume that the latin letters occur in 
> the execution character set in ascending consecutive order.
> (Though similar *is* guaranteed for the digits '0' to '9'!)


Not really -- assuming ASCII is like assuming 8-bit bytes[1]. Both could be
false at the dawn of time, but today trying to support that is a waste of
time. Too much code you rely on makes that assumption. It's called
"standardization".

Really, I'd say it's becoming reasonable to assume Unicode. Some platforms
like Android or musl don't support ancient charsets -- and good riddance!


Meow!

[1]. Byte != char, some special purpose processors even today have 32-bit
chars (ie, are unable to address individual bytes without bit twiddling)
which is legal according to the C standard.
--
An imaginary friend squared is a real enemy.