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


Groups > comp.lang.c > #108517

Re: Variable naming issue

From David Brown <david.brown@hesbynett.no>
Newsgroups comp.lang.c
Subject Re: Variable naming issue
Date 2017-04-26 10:10 +0200
Organization A noiseless patient Spider
Message-ID <odpkgh$3pm$1@dont-email.me> (permalink)
References (8 earlier) <87wpa8y5vb.fsf@bsb.me.uk> <lnh91cnwtx.fsf@kst-u.example.com> <d%OLA.526450$8b6.223935@fx19.am4> <odohl3$iln$1@dont-email.me> <tKQLA.535077$987.473156@fx20.am4>

Show all headers | View raw


On 26/04/17 01:13, bartc wrote:
> On 25/04/2017 23:16, David Brown wrote:
>> On 25/04/17 23:14, bartc wrote:
>>> On 25/04/2017 19:52, Keith Thompson wrote:
>>>
>>>> Even ignoring all that, the amount of work required to implement
>>>> a feature is only one of a number of considerations that should
>>>> affect the decision of whether to support that feature.
>>>
>>> Yet, it's supported by DMC. By gcc. By MSVC. By Pelles C. By Clang. By
>>> nearly all the C compilers on Godbolt.
>>>
>>> With a feature already so widespread, it becomes problematic /not/
>>> having it.
>>
>> It would only be a problem if the /use/ of $ in identifiers in C was
>> widespread, rather than just the compiler support for it.  Further, the
>> $ would need to be used in code that is not bound to particular
>> compilers in other ways (such as requiring the modern C11 standard, or
>> support for multiple target cpus, or other compiler extensions).
> 
> It's Catch-22: I don't use $ in any of my C code that I want anyone else
> to compile. /Because/ support is not guaranteed.

In the C world, there are standards to say what is guaranteed for a wide
range of tools.  There are common extensions that are available on many
tools - the C standards even mentions some, including the use of $ in
identifiers (J.5.2 if you want to look it up).  And of course not all
tools support the standards as well as might be wished.  But the
standards are the nearest there is to giving the guaranteed behaviour
for a C compiler - and they don't include $ in identifiers.

> 
> (Which is a bit of a nuisance. If I need a series of temps, they end up
> being called _1, _2, _3, instead of $1, $2, $3.)

I can't see any problem with that.  You are talking about temporary
identifiers generated in intermediary code by a translator, which will
normally only be seen by the backend C compiler.  Pretty much the only
person who will ever see these identifiers will be /you/, as the creator
and debugger of the translator program.  _1, _2, _3 are fine names - as
are tXwZ_1, tXwZ_2, etc., and anything else unlikely to clash with a
user symbol.  (It is absolutely fine for you, in specifying your
language, to say that any identifiers starting with tXwZ are reserved
for the implemnentation.)

If you think the use of $ is better than alternatives, and it works with
the backends you want to support, then use $.  If you want to use
backends that don't work with $, then don't use it.  It is that simple.

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


Thread

Variable naming issue maximus fl <ajones2600@gmail.com> - 2017-04-24 16:17 -0700
  Re: Variable naming issue David Kleinecke <dkleinecke@gmail.com> - 2017-04-24 16:28 -0700
  Re: Variable naming issue bartc <bc@freeuk.com> - 2017-04-25 01:09 +0100
    Re: Variable naming issue Noob <root@127.0.0.1> - 2017-04-25 09:37 +0200
      Re: Variable naming issue bartc <bc@freeuk.com> - 2017-04-25 10:40 +0100
        Re: Variable naming issue David Brown <david.brown@hesbynett.no> - 2017-04-25 13:07 +0200
          Re: Variable naming issue bartc <bc@freeuk.com> - 2017-04-25 13:24 +0100
            Re: Variable naming issue bartc <bc@freeuk.com> - 2017-04-25 13:27 +0100
            Re: Variable naming issue Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-04-25 13:59 +0100
              Re: Variable naming issue bartc <bc@freeuk.com> - 2017-04-25 14:20 +0100
                Re: Variable naming issue Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-04-25 14:27 +0100
                Re: Variable naming issue Keith Thompson <kst-u@mib.org> - 2017-04-25 11:52 -0700
                Re: Variable naming issue Malcolm McLean <malcolm.mclean5@btinternet.com> - 2017-04-25 13:40 -0700
                Re: Variable naming issue bartc <bc@freeuk.com> - 2017-04-25 22:14 +0100
                Re: Variable naming issue David Brown <david.brown@hesbynett.no> - 2017-04-26 00:16 +0200
                Re: Variable naming issue bartc <bc@freeuk.com> - 2017-04-26 00:13 +0100
                Re: Variable naming issue David Brown <david.brown@hesbynett.no> - 2017-04-26 10:10 +0200
                Re: Variable naming issue supercat@casperkitty.com - 2017-04-25 14:33 -0700
                Re: Variable naming issue Malcolm McLean <malcolm.mclean5@btinternet.com> - 2017-04-25 06:39 -0700
                Re: Variable naming issue Robert Wessel <robertwessel2@yahoo.com> - 2017-04-25 09:35 -0500
              Re: Variable naming issue Gareth Owen <gwowen@gmail.com> - 2017-04-25 18:39 +0100
                Re: Variable naming issue bartc <bc@freeuk.com> - 2017-04-25 18:49 +0100
                Re: Variable naming issue David Kleinecke <dkleinecke@gmail.com> - 2017-04-25 11:19 -0700
                Re: Variable naming issue bartc <bc@freeuk.com> - 2017-04-25 19:31 +0100
                Re: Variable naming issue Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-04-25 23:36 +0100
                Re: Variable naming issue David Kleinecke <dkleinecke@gmail.com> - 2017-04-25 17:04 -0700
                Re: Variable naming issue Robert Wessel <robertwessel2@yahoo.com> - 2017-04-26 00:32 -0500
            Re: Variable naming issue David Brown <david.brown@hesbynett.no> - 2017-04-25 16:02 +0200
            Re: Variable naming issue Tim Rentsch <txr@alumni.caltech.edu> - 2017-05-02 05:25 -0700
              Re: Variable naming issue supercat@casperkitty.com - 2017-05-02 10:04 -0700
                Re: Variable naming issue Tim Rentsch <txr@alumni.caltech.edu> - 2017-05-05 03:06 -0700
          Re: Variable naming issue supercat@casperkitty.com - 2017-04-25 07:12 -0700
          Re: Variable naming issue Robert Wessel <robertwessel2@yahoo.com> - 2017-04-25 09:48 -0500
            Re: Variable naming issue Robert Wessel <robertwessel2@yahoo.com> - 2017-04-25 09:52 -0500
        Re: Variable naming issue Noob <root@127.0.0.1> - 2017-04-26 08:46 +0200
          Re: Variable naming issue bartc <bc@freeuk.com> - 2017-04-26 11:46 +0100
          Re: Variable naming issue bartc <bc@freeuk.com> - 2017-04-26 12:00 +0100
        Re: Variable naming issue gordonb.o1c18@burditt.org (Gordon Burditt) - 2017-05-07 22:25 -0500
          Re: Variable naming issue bartc <bc@freeuk.com> - 2017-05-08 10:35 +0100
            Re: Variable naming issue bartc <bc@freeuk.com> - 2017-05-08 10:53 +0100
              Re: Variable naming issue David Kleinecke <dkleinecke@gmail.com> - 2017-05-08 11:47 -0700
                Re: Variable naming issue bartc <bc@freeuk.com> - 2017-05-08 19:59 +0100
      Re: Variable naming issue gazelle@shell.xmission.com (Kenny McCormack) - 2017-04-25 10:43 +0000
    Re: Variable naming issue Robert Wessel <robertwessel2@yahoo.com> - 2017-04-25 09:33 -0500
  Re: Variable naming issue Keith Thompson <kst-u@mib.org> - 2017-04-24 17:26 -0700
    Re: Variable naming issue maximus fl <ajones2600@gmail.com> - 2017-04-24 18:18 -0700
  Re: Variable naming issue scott@slp53.sl.home (Scott Lurndal) - 2017-04-25 14:48 +0000

csiph-web