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


Groups > comp.lang.c++ > #121024

Re: Command Languages Versus Programming Languages

Path csiph.com!weretis.net!feeder9.news.weretis.net!news.quux.org!eternal-september.org!feeder2.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From Tim Rentsch <tr.17687@z991.linuxsc.com>
Newsgroups comp.lang.c++
Subject Re: Command Languages Versus Programming Languages
Date Tue, 26 Nov 2024 04:14:58 -0800
Organization A noiseless patient Spider
Lines 50
Message-ID <86plmiqji5.fsf@linuxsc.com> (permalink)
References <uu54la$3su5b$6@dont-email.me> <e47664d3-7f9b-4e67-aa73-b72c6cc0687a@alumni.caltech.edu> <vhr0uc$656$1@reader2.panix.com> <vhrmk1$1ivhr$1@dont-email.me> <vhsnff$pk5$1@reader2.panix.com> <vhspmp$1o17j$1@dont-email.me> <26a35ceb3dd8fe913f59c2ac8a2b01b99e462c2e@i2pn2.org>
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Injection-Date Tue, 26 Nov 2024 13:15:08 +0100 (CET)
Injection-Info dont-email.me; posting-host="1ebfc87b5a97bb6cfe9751ebbb383b2b"; logging-data="3626788"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19qY9+7QAOgxVn+PGyvuw5fSz4tMS0TENE="
User-Agent Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock sha1:Rw05Nyx2YnaC0cnmG3PUGzycIoE= sha1:IFzUUiJIF1BDWMFz7KIfLvq3EoY=
Xref csiph.com comp.lang.c++:121024

Show key headers only | View raw


Richard Damon <richard@damon-family.org> writes:

> On 11/23/24 9:43 AM, James Kuyper wrote:
>
>> On 11/23/24 09:05, Dan Cross wrote:
>>
>>> In article <vhrmk1$1ivhr$1@dont-email.me>,
>>> James Kuyper <jameskuyper@alumni.caltech.edu> wrote:
>>
>> ...
>>
>>>> Your wording could easily give the false impression, to anyone
>>>> who didn't already know better, that promotion of unsigned char
>>>> to signed int is required by the standard, rather than it being
>>>> dependent upon whether UCHAR_MAX > INT_MAX.
>>>
>>> Actually I'm not sure that it did.  Note the part that you quoted
>>> above that says, "the entire range values is expressible in a
>>> signed int."  This implies UCHAR_MAX <= INT_MAX.  (By "values" I
>>> meant, "values of that type", not specific values in any given
>>> program).
>>
>> You paired that assertion with "`unsigned char` has _rank_ lower
>> than _int_", which is a fact guaranteed by the standard, which
>> could easily give the impression that the comment about the range
>> of values was either explicitly stated in the standard, or
>> correctly inferrable from the statement about the ranks.
>
> I don't think unsigned char is guarateed by the standard to be
> less than that of int.

The integer conversion rank of unsigned char is guaranteed to be
less than the integer conversion rank of int (which incidentally is
the same as the integer conversion rank of unsigned int).

But the set of values of unsigned char is not guaranteed to be a
subset of the set of values of int.

> On a machine with wide bytes (like some DSP processors) sizeof int
> could be 1, which results is some unexpected results,
> like UCHAR_MAX > INT_MAX.

sizeof (int) == 1 is sufficient but not necessary.

As long as CHAR_BIT > 15, it is possible for UCHAR_MAX > INT_MAX
regardless of the value of sizeof (int).

It would be amusing to see an implementation where CHAR_BIT == 16,
and sizeof (int) == sizeof (long) == sizeof (long long) == 4, but
nevertheless UCHAR_MAX > INT_MAX.

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Re: Command Languages Versus Programming Languages James Kuyper <jameskuyper@alumni.caltech.edu> - 2024-11-23 09:43 -0500
  Re: Command Languages Versus Programming Languages Richard Damon <richard@damon-family.org> - 2024-11-23 10:39 -0500
    Re: Command Languages Versus Programming Languages Tim Rentsch <tr.17687@z991.linuxsc.com> - 2024-11-26 04:14 -0800
      Re: Command Languages Versus Programming Languages Richard Damon <richard@damon-family.org> - 2024-11-26 10:02 -0500

csiph-web