Chris H <chris@[EMAIL PROTECTED]
> writes:
> In message <slrng2jh6c.1pn.willem@[EMAIL PROTECTED]
>, Willem
> <willem@[EMAIL PROTECTED]
> writes
>>Chris H wrote:
>>) In message <48299ac3.2182222981@[EMAIL PROTECTED]
>, Richard Bos
>>)<rlb@[EMAIL PROTECTED]
> writes
>>)>Chris H <chris@[EMAIL PROTECTED]
> wrote:
>>)>
>>)>> Do compilers still accept char unsigned? Some used to but I bet
many
>>)>> don't now
>>)>
>>)>They had bloody better. You may not like it, but, like voting for
Gordon
>>)>Brown, it's perfectly legal even if unusual and in some people's
opinion
>>)>disgusting.
>>)
>>) Some one, elsewhere in this thread, did a search on "char unsigned"
and
>>) go no hits at all.
>>)
>>) Has any one actually seen "char unsigned" used anywhere?
>>
>>Irrelevant.
>
> Why?
>
> If it is something no one has used and no one has seen used (and some
> people hare can remember back to the start of C) why is it still there?
Currently, the language states (C99 6.7.2p2) that "the type specifiers
may occur in any order, possibly intermixed with the other declaration
specifiers".
This rule allows silly things like "long unsigned long", "double
long", "long int unsigned long", and so forth. (I deliberately chose
examples that I *think* everyone would agree are silly.)
Changing this would require a more complicated set of rules, with the
risk that either the authors of the standard or some implementers
might get them wrong. Such a change could break existing code; it
would *definitely* cause some code that's currently legal to become
illegal. It would require a new revision of the C standard, along
with updates to textbooks, tutorials, implementations, and tools other
than compilers that parse C code. I can't guess how much effort would
be required, but I wouldn't be surprised if it were several
person-years. It would only infinitesimally increase the difficulty
of writing ugly C code. And those few programmers who like to write
"char unsigned" could safely continue to do so until C20?? compilers
replace compilers for earlier versions of the standard, something that
hasn't even happened for C99.
If I were designing a new language, I probably wouldn't permit that
particular kind of flexibility. (For that matter, the names of the
fundamental types would probably be single keywords or identifiers, so
the issue wouldn't arise in the first place.) But for an existing
language, I really don't think this minor flaw (which not everyone
even agrees is a flaw) is worth fixing.
--
Keith Thompson (The_Other_Keith) kst-u@[EMAIL PROTECTED]
<http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"


|