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


Groups > comp.lang.c > #163257

Re: on the order of the const-keyword

From Bart <bc@freeuk.com>
Newsgroups comp.lang.c
Subject Re: on the order of the const-keyword
Date 2021-10-29 23:51 +0100
Organization A noiseless patient Spider
Message-ID <slhtss$636$1@dont-email.me> (permalink)
References (1 earlier) <slg9ru$nmg$1@dont-email.me> <slgigl$pss$1@dont-email.me> <slh0j8$26m$1@dont-email.me> <slh4vq$neb$1@dont-email.me> <slh7j5$ohl$1@dont-email.me>

Show all headers | View raw


On 29/10/2021 17:30, David Brown wrote:
> On 29/10/2021 17:45, Bart wrote:

>> They presumably do do so (even if it's indirectly via macros), otherwise
>> most alternatives for writing the same type would long have been
>> deprecated from the language, with tighter rules as to the placement and
>> number of 'const' attributes.
>>
> 
> Why?  What would be the advantages of deprecating it?  It would make no
> difference to people writing C, but mean extra checks would have to be
> added to compliant compilers as well as changes to the grammar in the
> standards document.

It actually makes compilation simpler, if you knew for example that the 
pattern was always:

    [const] [unsigned/signed] [long [long] / short] int

As to the advantages of deprecating it, the behaviour of most compilers, 
using default options, is to be incredibly lax about things that I 
consider irresponsibly dangerous.

So people continue their bad coding habits, because they are not like 
you in devising a strict dialect of the language, and implementing that 
dialect via sets of compiler options.

> And there may conceivably be some odd program with
> code like this

Or maybe you write the code by accident. Then you are either puzzled why 
it doesn't work, or don't notice, until it puzzles someone else.

  - perhaps something with a history so far back that it
> used macros instead of typedefs and ended up with such results.  All in
> all, making such changes would be all effort and no gain.

It can be easier than you think. My own compiler disallows many things I 
consider unacceptable. But for the purposes of compiling legacy code, I 
require one special option to be specified.

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


Thread

on the order of the const-keyword Meredith Montgomery <mmontgomery@levado.to> - 2021-10-28 12:50 -0300
  Re: on the order of the const-keyword Bart <bc@freeuk.com> - 2021-10-28 17:25 +0100
    Re: on the order of the const-keyword "james...@alumni.caltech.edu" <jameskuyper@alumni.caltech.edu> - 2021-10-28 10:10 -0700
      Re: on the order of the const-keyword Guillaume <message@bottle.org> - 2021-10-28 20:40 +0200
      Re: on the order of the const-keyword Meredith Montgomery <mmontgomery@levado.to> - 2021-10-29 00:07 -0300
        Re: on the order of the const-keyword James Kuyper <jameskuyper@alumni.caltech.edu> - 2021-10-29 00:48 -0400
    Re: on the order of the const-keyword Thiago Adams <thiago.adams@gmail.com> - 2021-10-28 12:56 -0700
      Re: on the order of the const-keyword Thiago Adams <thiago.adams@gmail.com> - 2021-10-28 13:18 -0700
        Re: on the order of the const-keyword Bart <bc@freeuk.com> - 2021-10-28 21:35 +0100
          Re: on the order of the const-keyword Thiago Adams <thiago.adams@gmail.com> - 2021-10-28 13:57 -0700
            Re: on the order of the const-keyword Thiago Adams <thiago.adams@gmail.com> - 2021-10-28 14:07 -0700
              Re: on the order of the const-keyword Bart <bc@freeuk.com> - 2021-10-28 22:54 +0100
              Re: on the order of the const-keyword Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-10-28 15:37 -0700
                Re: on the order of the const-keyword Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-10-29 00:02 +0100
        Re: on the order of the const-keyword Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-10-28 22:10 +0100
        Re: on the order of the const-keyword Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-10-28 15:13 -0700
        Re: on the order of the const-keyword Meredith Montgomery <mmontgomery@levado.to> - 2021-10-29 00:40 -0300
    Re: on the order of the const-keyword Meredith Montgomery <mmontgomery@levado.to> - 2021-10-28 23:48 -0300
  Re: on the order of the const-keyword James Kuyper <jameskuyper@alumni.caltech.edu> - 2021-10-28 13:04 -0400
    Re: on the order of the const-keyword Meredith Montgomery <mmontgomery@levado.to> - 2021-10-29 00:34 -0300
  Re: on the order of the const-keyword David Brown <david.brown@hesbynett.no> - 2021-10-29 10:03 +0200
    Re: on the order of the const-keyword Bart <bc@freeuk.com> - 2021-10-29 11:30 +0100
      Re: on the order of the const-keyword David Brown <david.brown@hesbynett.no> - 2021-10-29 16:31 +0200
        Re: on the order of the const-keyword Bart <bc@freeuk.com> - 2021-10-29 16:45 +0100
          Re: on the order of the const-keyword David Brown <david.brown@hesbynett.no> - 2021-10-29 18:30 +0200
            Re: on the order of the const-keyword Manfred <noname@add.invalid> - 2021-10-30 00:32 +0200
              Re: on the order of the const-keyword Meredith Montgomery <mmontgomery@levado.to> - 2021-10-29 20:03 -0300
              Re: on the order of the const-keyword Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-10-30 01:10 +0100
            Re: on the order of the const-keyword Bart <bc@freeuk.com> - 2021-10-29 23:51 +0100
    Re: on the order of the const-keyword Meredith Montgomery <mmontgomery@levado.to> - 2021-10-29 12:22 -0300
      Re: on the order of the const-keyword David Brown <david.brown@hesbynett.no> - 2021-10-29 18:34 +0200
        Re: on the order of the const-keyword Meredith Montgomery <mmontgomery@levado.to> - 2021-10-29 17:04 -0300

csiph-web