Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: Variable naming issue Date: Tue, 25 Apr 2017 11:52:58 -0700 Organization: None to speak of Lines: 48 Message-ID: References: <87efwgzlqj.fsf@bsb.me.uk> <87wpa8y5vb.fsf@bsb.me.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="3b562cdb4c8656e7cfa2f1213451a6cc"; logging-data="1081"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Zko51Ls+p6LpNn6rd1ksS" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:1SSYXG1JNmlyxDTFdBgErDTIFbU= sha1:l9oRSCz1mzZLIwioUfozjPRd/jw= Xref: csiph.com comp.lang.c:108485 Ben Bacarisse writes: > bartc writes: >> On 25/04/2017 13:59, Ben Bacarisse wrote: > >>> Whatever their "excuse" it's not code size since tcc /does/ use $, it's >>> [just] they decided to use it differently. >> >> In what way? I've seen it in the source code, but for something called >> an 'ldname'. > > I don't know, but it is pre-processed as a single-character token so > using it in names would require a change rather than an addition. The $ character isn't part of the basic source or execution character set, so it needn't be pre-processed at all. A conforming C implementation could easily exist on a system that doesn't support the $ character at all. Both ASCII and EBCDIC include it, so that's not likely in practice -- but in the past there might have been ASCII-based character sets that substitute some other character for $ (I'm not sufficiently interested to verify that). Sure, it might be a one-line compiler change to permit $ in identifiers. Actually more than that since it would need to be diagnosed in conforming mode, unless you want to change the language to allow it unconditionally -- and even then real-world C compilers are going to have modes to enforce conformance to earlier C standards. And if C identifiers are mapped directly to assembly language identifiers and/or linker symbols, there will have to be additional code to generate valid identifiers if the assembler or linker doesn't like $, or doesn't like it exactly the same way the C compiler does (can it start an identifier?). A similar level of work could allow @ and ` in identifiers. But then allowing ` would interfere with Markdown, which is commonly used to quote snippets of C source code, and @ might cause other problems. 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. I've never thought that C's problem is that it doesn't use enough punctuation characters. -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"