Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #2187 > unrolled thread

Is char obsolete?

Started byLauri Alanko <la@iki.fi>
First post2011-04-08 13:06 +0000
Last post2011-04-08 23:07 +0200
Articles 3 on this page of 23 — 12 participants

Back to article view | Back to comp.lang.c


Contents

  Is char obsolete? Lauri Alanko <la@iki.fi> - 2011-04-08 13:06 +0000
    Re: Is char obsolete? Chris H <chris@phaedsys.org> - 2011-04-08 14:55 +0100
    Re: Is char obsolete? Thomas Richter <thor@math.tu-berlin.de> - 2011-04-08 17:04 +0200
      Re: Is char obsolete? Chris H <chris@phaedsys.org> - 2011-04-08 16:32 +0100
        Re: Is char obsolete? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-04-08 17:02 +0100
        Re: Is char obsolete? Thomas Richter <thor@math.tu-berlin.de> - 2011-04-09 21:57 +0200
          Re: Is char obsolete? James Kuyper <jameskuyper@verizon.net> - 2011-04-09 16:47 -0400
            Re: Is char obsolete? William Ahern <william@wilbur.25thandClement.com> - 2011-04-09 15:10 -0700
              Re: Is char obsolete? James Kuyper <jameskuyper@verizon.net> - 2011-04-09 18:44 -0400
    Re: Is char obsolete? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-04-08 16:13 +0100
      Re: Is char obsolete? Keith Thompson <kst-u@mib.org> - 2011-04-08 12:55 -0700
        Re: Is char obsolete? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-04-08 22:16 +0100
    Re: Is char obsolete? Lauri Alanko <la@iki.fi> - 2011-04-08 17:04 +0000
      Re: Is char obsolete? Nobody <nobody@nowhere.com> - 2011-04-08 20:10 +0100
        Re: Is char obsolete? "robertwessel2@yahoo.com" <robertwessel2@yahoo.com> - 2011-04-08 15:43 -0700
          Re: Is char obsolete? Nobody <nobody@nowhere.com> - 2011-04-09 22:44 +0100
      Re: Is char obsolete? "BartC" <bc@freeuk.com> - 2011-04-08 21:04 +0100
        Re: Is char obsolete? William Ahern <william@wilbur.25thandClement.com> - 2011-04-08 15:01 -0700
          Re: Is char obsolete? Lauri Alanko <la@iki.fi> - 2011-04-09 14:27 +0000
            Re: Is char obsolete? "BartC" <bc@freeuk.com> - 2011-04-09 19:14 +0100
            Re: Is char obsolete? William Ahern <william@wilbur.25thandClement.com> - 2011-04-09 12:02 -0700
      Re: Is char obsolete? Ian Collins <ian-news@hotmail.com> - 2011-04-09 09:40 +1200
    Re: Is char obsolete? Florian Weimer <fw@deneb.enyo.de> - 2011-04-08 23:07 +0200

Page 2 of 2 — ← Prev page 1 [2]


#2272

FromWilliam Ahern <william@wilbur.25thandClement.com>
Date2011-04-09 12:02 -0700
Message-ID<03n678-uc8.ln1@wilbur.25thandClement.com>
In reply to#2249
Lauri Alanko <la@iki.fi> wrote:
> In article <p6d478-egg.ln1@wilbur.25thandClement.com>,
> William Ahern  <william@wilbur.25thandClement.com> wrote:
> > All wider types do is obscure the problem. The OP should sit down with a
> > book on Unicode and learn the difference between abstract characters,
> > combining characters, code points, graphemes, grapheme clusters,
> > etc.

> The OP is familiar with Unicode, thank you very much.

> I happen to agree with you that the entire concept of "character" is
> bogus, and there are quite a number of reasonable ways to decompose a
> string.

> But my original point was that char is useless. You are retorting by
> saying that wchar_t is also useless. That may be, but I don't see how
> that is any kind of a defense for char.

Fair enough. I was partly responding to your later suggestion of a struct
object. But if your replacement of char doesn't actually do anything
substantive except appease your sensibilities, what's the point? Something
like int8_t could only ever be a typedef to char anyhow, given that char is
the fundamental unit of memory. (If char was more than 8 bits it'd have to
be int8_least_t.) Your argument seemed to be predicated on an unspecified,
superior alternative. The fact that you can't articulate it should be a hint
that there likely is no satisfactory alternative.

> > Perl 6 comes the closest, AFAIU, to addressing the complexity of Unicode by
> > inventing it's own normalization form, "NFG". At runtime it builds a
> > "grapheme table" mapping new code points to irreducible sets of Unicode code
> > points so that strings can be indexed with sensible results.

> How does it handle XML, then, since the meaning of an XML document can
> be changed during normalization?

The same way any other processor does (or doesn't), I suppose. It wouldn't
be unique in this regard, nor AFAIU is the issue limited to encoding
representation (e.g. whitespace and presence or absence of character
entities can change the "meaning" of a document, if by meaning we consider
what the producer and consumer expect above and beyond what XML can narrowly
guarantee).

I ran across this while Googling:

	I was walking across a bridge one day, and I saw a man standing on
	the edge, about to jump off. So I ran over and said, "Stop! Don't do
	it!"

	"I can't help it," he cried. "I've lost my will to live."

	"What do you do for a living?" I asked.

	He said, "I create web services specifications."

	"Me too!" I said. "Do you use REST web services or SOAP web
	services?"

	He said, "REST web services."

	"Me too!" I said. "Do you use text-based XML or binary XML?"

	He said, "Text-based XML."

	"Me too!" I said. "Do you use XML 1.0 or XML 1.1?"

	He said, "XML 1.0."

	"Me too!" I said. "Do you use UTF-8 or UTF-16?"

	He said, "UTF-8."

	"Me too!" I said. "Do you use Unicode Normalization Form C or
	Unicode Normalization Form KC?"

	He said, "Unicode Normalization Form KC."

	"Die, heretic scum!" I shouted, and I pushed him over the edge.

	-- http://diveintomark.org/archives/2004/07/06/nfc

[toc] | [prev] | [next] | [standalone]


#2206

FromIan Collins <ian-news@hotmail.com>
Date2011-04-09 09:40 +1200
Message-ID<909dnaF5u1U9@mid.individual.net>
In reply to#2198
On 04/ 9/11 05:04 AM, Lauri Alanko wrote:
> Some clarifications.
>
> Firstly, I'm talking specifically about the type "char". The
> types "signed char" and "unsigned char" are perfectly
> useful (though idiosyncratically named) integer types for
> operating on the smallest addressable memory
> units (a.k.a. bytes).
>
> The type "char" is distinct from these, and it is strictly less
> useful as an integer (due to its implementation-specific
> signedness). So the only justification for it that I can see is
> that it serves as a semantic annotation: a char is a byte that is
> intended to be interpreted as a character in the basic execution
> character set.
>
> But I'm saying that nowadays the basic execution character set no
> longer suffices for general-purpose text manipulation. So
> wherever you need to manipulate an individual character as a
> character, you'd better use wchar_t or similar.

That depends on where, and on what you are working.  Working in an 
English speaking country on Unix/Linux system programming or embedded 
controllers, wchar_t is almost unknown.

-- 
Ian Collins

[toc] | [prev] | [next] | [standalone]


#2204

FromFlorian Weimer <fw@deneb.enyo.de>
Date2011-04-08 23:07 +0200
Message-ID<87tye8cv0m.fsf@mid.deneb.enyo.de>
In reply to#2187
* Lauri Alanko:

> But nowadays Unicode is everywhere, and the de facto standard
> encoding is UTF-8.

It's not on Windows, where UTF-16 is pervasive, or with Java.  Some
other platforms have been infected by that, too.

> And in those rare situations where one can still assume
> that all the world is ASCII (or Latin-1, or even EBCDIC), there
> is still no benefit to using char over unsigned char. Apart from
> legacy library APIs, of course.

Even when restricting yourself to GNU/Linux platforms, the signedness
of the char type is not consistent across architectures.  So char
seems rather unusable indeed.

I use char * and especially const char * to denote zero-terminated
strings and unsigned char * for arbitrary binary blobs (usually
combined with an explicit length).  But that's probably just an odd
personal preference.

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | comp.lang.c


csiph-web