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


Groups > comp.lang.c > #151933

Re: longer 'char literals' meaning in c

From Keith Thompson <Keith.S.Thompson+u@gmail.com>
Newsgroups comp.lang.c
Subject Re: longer 'char literals' meaning in c
Date 2020-05-01 13:11 -0700
Organization None to speak of
Message-ID <87wo5v2z6v.fsf@nosuchdomain.example.com> (permalink)
References (11 earlier) <KXSqG.219100$dx4.181445@fx05.am4> <4aea0111-3c1d-4763-82b5-20c56d0a7ad8@googlegroups.com> <JJWqG.306472$QJp.205339@fx08.am4> <878sib4mp4.fsf@nosuchdomain.example.com> <t4%qG.450359$8qv1.115159@fx12.am4>

Show all headers | View raw


Bart <bc@freeuk.com> writes:
[...]
> I said this up-thread:
>
> BC:"C with 32-bit ints also limit the length to 4 characters."
>
> which you decided to dispute by pedantically saying that C allows more
> than 4 characters, even though only 4 will be significant.
>
> How will that information be of use to anyone?

It is of use *to most people here* to understand what the C standard
actually says.  I understand that you don't consider that to be of any
use to you.  I don't understand why you insist on discussing something
that you claim not to care about, or why you seem to be unable to deal
with the fact that other people *do* care about it.

And I never said that 4 characters will be significant.  It's very
likely that 4 characters will be significant (for an implementation with
32-bit int and 8-bit char), but the standard doesn't guarantee it.

> C doesn't magically let them write "if (cmd == 'ABCDEF')" in the same
> way that the same implementation allows "if(cmd == 'ABCD')", and most
> implementations don't even properly point out that the former will
> never work as intended.
>
> To repeat: for all practical purposes, 32-bit C compilers that
> meaningfully support 'ABC' constants at all, limit them to 'ABCD'.

It depends on what you mean by "limit", something that you never made
clear.  Some compilers "limit" them by ignoring the extra characters,
perhaps with a warning.  Some "limit" them by rejecting them (which is
non-conforming behavior).

My point is this: A conforming C compiler must accept 'ABCDEF' as a
valid character constant.  Equivalently, a C compiler that rejects
'ABCDEF' (meaning that it fails to translate a translation unit
containing it) is non-conforming.

If you don't care about that fact, that's fine.
If you agree with it, that's great.
If you disagree with it, you're wrong.

And if you want to drop this, now would be a good time.

-- 
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Philips Healthcare
void Void(void) { Void(); } /* The recursive call of the void */

Back to comp.lang.c | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

longer 'char literals' meaning in c fir <profesor.fir@gmail.com> - 2020-04-30 04:43 -0700
  Re: longer 'char literals' meaning in c Bonita Montero <Bonita.Montero@gmail.com> - 2020-04-30 13:55 +0200
    Re: longer 'char literals' meaning in c fir <profesor.fir@gmail.com> - 2020-04-30 05:17 -0700
      Re: longer 'char literals' meaning in c fir <profesor.fir@gmail.com> - 2020-04-30 05:22 -0700
        Re: longer 'char literals' meaning in c fir <profesor.fir@gmail.com> - 2020-04-30 05:24 -0700
          Re: longer 'char literals' meaning in c fir <profesor.fir@gmail.com> - 2020-04-30 05:29 -0700
            Re: longer 'char literals' meaning in c fir <profesor.fir@gmail.com> - 2020-04-30 06:16 -0700
        Re: longer 'char literals' meaning in c fir <profesor.fir@gmail.com> - 2020-04-30 05:44 -0700
      Re: longer 'char literals' meaning in c Bart <bc@freeuk.com> - 2020-04-30 14:00 +0100
        Re: longer 'char literals' meaning in c fir <profesor.fir@gmail.com> - 2020-04-30 06:13 -0700
          Re: longer 'char literals' meaning in c Bart <bc@freeuk.com> - 2020-04-30 14:41 +0100
            Re: longer 'char literals' meaning in c fir <profesor.fir@gmail.com> - 2020-04-30 07:18 -0700
              Re: longer 'char literals' meaning in c fir <profesor.fir@gmail.com> - 2020-04-30 07:31 -0700
                Re: longer 'char literals' meaning in c Spiros Bousbouras <spibou@gmail.com> - 2020-04-30 15:49 +0000
                Re: longer 'char literals' meaning in c fir <profesor.fir@gmail.com> - 2020-04-30 09:12 -0700
              Re: longer 'char literals' meaning in c Bart <bc@freeuk.com> - 2020-04-30 15:49 +0100
                Re: longer 'char literals' meaning in c fir <profesor.fir@gmail.com> - 2020-04-30 08:31 -0700
        Re: longer 'char literals' meaning in c Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-04-30 14:00 -0700
          Re: longer 'char literals' meaning in c Spiros Bousbouras <spibou@gmail.com> - 2020-04-30 21:16 +0000
            Re: longer 'char literals' meaning in c Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-04-30 15:22 -0700
            Re: longer 'char literals' meaning in c James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-04-30 18:36 -0400
          Re: longer 'char literals' meaning in c Bart <bc@freeuk.com> - 2020-04-30 22:25 +0100
            Re: longer 'char literals' meaning in c Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-04-30 15:30 -0700
              Re: longer 'char literals' meaning in c Bart <bc@freeuk.com> - 2020-05-01 00:01 +0100
                Re: longer 'char literals' meaning in c fir <profesor.fir@gmail.com> - 2020-04-30 16:15 -0700
                Re: longer 'char literals' meaning in c fir <profesor.fir@gmail.com> - 2020-04-30 16:29 -0700
                Re: longer 'char literals' meaning in c Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-04-30 17:15 -0700
                Re: longer 'char literals' meaning in c Bart <bc@freeuk.com> - 2020-05-01 01:47 +0100
                Re: longer 'char literals' meaning in c James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-04-30 18:38 -0700
                Re: longer 'char literals' meaning in c Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-04-30 18:55 -0700
                Re: longer 'char literals' meaning in c Bart <bc@freeuk.com> - 2020-05-01 11:35 +0100
                Re: longer 'char literals' meaning in c James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-05-01 05:47 -0700
                Re: longer 'char literals' meaning in c fir <profesor.fir@gmail.com> - 2020-05-01 06:15 -0700
                Re: longer 'char literals' meaning in c Bart <bc@freeuk.com> - 2020-05-01 15:53 +0100
                Re: longer 'char literals' meaning in c Richard Damon <Richard@Damon-Family.org> - 2020-05-01 12:38 -0400
                Re: longer 'char literals' meaning in c Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-05-01 09:57 -0700
                Re: longer 'char literals' meaning in c Bart <bc@freeuk.com> - 2020-05-01 20:50 +0100
                Re: longer 'char literals' meaning in c Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-05-01 13:11 -0700
                Re: longer 'char literals' meaning in c jameskuyper@stellarscience.com - 2020-05-01 12:05 -0700
                Re: longer 'char literals' meaning in c James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-05-01 19:08 -0400
                Re: longer 'char literals' meaning in c Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-05-01 09:51 -0700
                Re: longer 'char literals' meaning in c David Brown <david.brown@hesbynett.no> - 2020-05-02 15:22 +0200
                Re: longer 'char literals' meaning in c Richard Damon <Richard@Damon-Family.org> - 2020-05-02 12:13 -0400
                Re: longer 'char literals' meaning in c Les Cargill <lcargill99@comcast.com> - 2020-05-04 00:17 -0500
                Re: longer 'char literals' meaning in c James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-05-04 10:51 -0400
                Re: longer 'char literals' meaning in c James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-05-04 10:23 -0400
                Re: longer 'char literals' meaning in c David Brown <david.brown@hesbynett.no> - 2020-05-04 16:48 +0200
                Re: longer 'char literals' meaning in c James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-05-04 12:39 -0400
                Re: longer 'char literals' meaning in c David Brown <david.brown@hesbynett.no> - 2020-05-04 19:37 +0200
                Re: longer 'char literals' meaning in c James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-05-04 15:03 -0400
                Re: longer 'char literals' meaning in c David Brown <david.brown@hesbynett.no> - 2020-05-05 08:33 +0200
                Re: longer 'char literals' meaning in c James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-05-05 09:47 -0400
                Re: longer 'char literals' meaning in c David Brown <david.brown@hesbynett.no> - 2020-05-05 16:22 +0200
                Re: longer 'char literals' meaning in c Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-05-04 10:27 -0700
                Re: longer 'char literals' meaning in c antispam@math.uni.wroc.pl - 2020-05-05 00:47 +0000
                Re: longer 'char literals' meaning in c Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-05-04 20:08 -0700
                Re: longer 'char literals' meaning in c James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-05-04 23:52 -0400
                Re: longer 'char literals' meaning in c antispam@math.uni.wroc.pl - 2020-05-05 17:10 +0000
                Re: longer 'char literals' meaning in c Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-05-05 13:41 -0700
                Re: longer 'char literals' meaning in c antispam@math.uni.wroc.pl - 2020-05-05 22:29 +0000
                Re: longer 'char literals' meaning in c Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-05-05 16:18 -0700
                Re: longer 'char literals' meaning in c antispam@math.uni.wroc.pl - 2020-05-06 02:33 +0000
                Re: longer 'char literals' meaning in c Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-05-05 20:06 -0700
                Re: longer 'char literals' meaning in c antispam@math.uni.wroc.pl - 2020-05-06 18:57 +0000
                Re: longer 'char literals' meaning in c Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-05-06 13:37 -0700
                Re: longer 'char literals' meaning in c Spiros Bousbouras <spibou@gmail.com> - 2020-05-07 13:48 +0000
                Re: longer 'char literals' meaning in c Spiros Bousbouras <spibou@gmail.com> - 2020-05-07 13:58 +0000
                Re: longer 'char literals' meaning in c Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-05-07 18:01 -0700
                Re: longer 'char literals' meaning in c James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-05-05 20:18 -0400
                Re: longer 'char literals' meaning in c antispam@math.uni.wroc.pl - 2020-05-06 20:01 +0000
                Re: longer 'char literals' meaning in c James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-05-06 18:20 -0400
                Re: longer 'char literals' meaning in c Siri Cruise <chine.bleu@yahoo.com> - 2020-04-30 20:13 -0700
      Re: longer 'char literals' meaning in c Bonita Montero <Bonita.Montero@gmail.com> - 2020-04-30 16:58 +0200
        Re: longer 'char literals' meaning in c Bonita Montero <Bonita.Montero@gmail.com> - 2020-04-30 16:59 +0200
        Re: longer 'char literals' meaning in c Bonita Montero <Bonita.Montero@gmail.com> - 2020-04-30 17:14 +0200
        Re: longer 'char literals' meaning in c fir <profesor.fir@gmail.com> - 2020-04-30 08:33 -0700
          Re: longer 'char literals' meaning in c Bonita Montero <Bonita.Montero@gmail.com> - 2020-04-30 18:15 +0200
      Re: longer 'char literals' meaning in c James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-04-30 08:33 -0700
        Re: longer 'char literals' meaning in c David Brown <david.brown@hesbynett.no> - 2020-04-30 17:49 +0200
          Re: longer 'char literals' meaning in c Bart <bc@freeuk.com> - 2020-04-30 17:23 +0100
            Re: longer 'char literals' meaning in c fir <profesor.fir@gmail.com> - 2020-04-30 09:38 -0700
              Re: longer 'char literals' meaning in c Bart <bc@freeuk.com> - 2020-04-30 17:56 +0100
                Re: longer 'char literals' meaning in c fir <profesor.fir@gmail.com> - 2020-04-30 10:04 -0700
                Re: longer 'char literals' meaning in c Bart <bc@freeuk.com> - 2020-04-30 18:28 +0100
                Re: longer 'char literals' meaning in c fir <profesor.fir@gmail.com> - 2020-04-30 10:39 -0700
                Re: longer 'char literals' meaning in c Bart <bc@freeuk.com> - 2020-04-30 19:16 +0100
                Re: longer 'char literals' meaning in c fir <profesor.fir@gmail.com> - 2020-04-30 11:24 -0700
                Re: longer 'char literals' meaning in c Bart <bc@freeuk.com> - 2020-04-30 19:58 +0100
                Re: longer 'char literals' meaning in c fir <profesor.fir@gmail.com> - 2020-04-30 12:08 -0700
                Re: longer 'char literals' meaning in c Bart <bc@freeuk.com> - 2020-04-30 20:16 +0100
                Re: longer 'char literals' meaning in c fir <profesor.fir@gmail.com> - 2020-04-30 12:29 -0700
                Re: longer 'char literals' meaning in c fir <profesor.fir@gmail.com> - 2020-04-30 12:10 -0700
                Re: longer 'char literals' meaning in c fir <profesor.fir@gmail.com> - 2020-04-30 11:17 -0700
                Re: longer 'char literals' meaning in c fir <profesor.fir@gmail.com> - 2020-04-30 10:31 -0700
                Re: longer 'char literals' meaning in c Bart <bc@freeuk.com> - 2020-04-30 19:20 +0100
                Re: longer 'char literals' meaning in c fir <profesor.fir@gmail.com> - 2020-04-30 11:28 -0700
          Re: longer 'char literals' meaning in c Richard Damon <Richard@Damon-Family.org> - 2020-04-30 13:48 -0400
        Re: longer 'char literals' meaning in c fir <profesor.fir@gmail.com> - 2020-04-30 09:01 -0700
      Re: longer 'char literals' meaning in c Vir Campestris <vir.campestris@invalid.invalid> - 2020-04-30 21:32 +0100
        Re: longer 'char literals' meaning in c fir <profesor.fir@gmail.com> - 2020-04-30 13:43 -0700
        Re: longer 'char literals' meaning in c Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2020-04-30 16:54 -0400
          Re: longer 'char literals' meaning in c Vir Campestris <vir.campestris@invalid.invalid> - 2020-05-03 21:23 +0100
            Re: longer 'char literals' meaning in c Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2020-05-03 16:48 -0400
  Re: longer 'char literals' meaning in c fir <profesor.fir@gmail.com> - 2020-04-30 11:38 -0700
    Re: longer 'char literals' meaning in c fir <profesor.fir@gmail.com> - 2020-04-30 11:57 -0700
      Re: longer 'char literals' meaning in c Bonita Montero <Bonita.Montero@gmail.com> - 2020-04-30 21:01 +0200
      Re: longer 'char literals' meaning in c Bart <bc@freeuk.com> - 2020-04-30 20:07 +0100
        Re: longer 'char literals' meaning in c fir <profesor.fir@gmail.com> - 2020-04-30 12:41 -0700
        Re: longer 'char literals' meaning in c Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-05-04 10:30 -0700

csiph-web