Is char obsolete?

J

James Kuyper

You're taking this a bit out of context. The next response by Chris was
"Char is the smallest using to hold a Character which may not be the same
thing."

I couldn't figure what he meant by that: I couldn't parse "using" as a
word to follow "smallest", so there's at least one missing or misspelled
word in that sentence. I couldn't see any obvious simple correction that
would allow the sentence to be interpreted in a way that made sense. One
of the non-nonsensical simple corrections I came up with corresponds to
your interpretation:
... that char could be wider than the byte
unit. ...

However, I didn't want to attribute that idea to him until I had better
evidence that it was in fact what he meant to say.

....
Compare C99

3.6
byte
addressable unit of data storage large enough to hold any
member of the basic character set of the execution environment

with

6.2.5p3
An object declared as type char is large enough to store any member
of the basic execution character set.

and

3.7.1
character
single-byte character<C> bit representation that fits in a byte

The byte unit and char object are inextricably conflated. I suppose you
could change the standard, but that's guaranteed to break code everywhere.
This conflation of unit and type is fundamental to the language we call C,
which is riddled with this sort of conceptual impurity. It's what makes it
so damned useful.

I don't see any conflation there. An object of type char may be stored
in a byte and is sufficiently large to represents a character.
Everything said in those three clauses seems, to me, to clearly retain
the distinction between the memory used to store an object, the thing
being represented by that object, and the data type that is used to
interpret the representation of that thing which is stored in that memory.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top