Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Bartc <bc@freeuk.com> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: Spurious diagnostic messages |
| Date | 2015-09-22 19:00 +0100 |
| Organization | A noiseless patient Spider |
| Message-ID | <mts4s0$2ff$1@dont-email.me> (permalink) |
| References | (13 earlier) <kfnvbbowwdj.fsf@x-alumni2.alumni.caltech.edu> <ln1tebuwdn.fsf@kst-u.example.com> <kfn8u8elc37.fsf@x-alumni2.alumni.caltech.edu> <lna8sunj8s.fsf@kst-u.example.com> <kfnlhbyhd51.fsf@x-alumni2.alumni.caltech.edu> |
On 22/09/2015 13:06, Tim Rentsch wrote: > Keith Thompson <kst-u@mib.org> writes: >> And you still haven't said *why* you dislike the idea of using the >> apostrophe as a digit separator. > > The natural choice in C for a numeric separator character is > underscore. I think a lot of the reasons for preferring > underscore to apostrophe are obvious, but let me list some: > > Underscore does a better job of providing visual separation > (because there is only blank space in the regular character > area). > > An apostrophe might be mistakenly read for a digit (eg, 1) > on a casual reading (and depending on font). The chance > of misreading an underscore for a digit is much lower. I've never found that. Although I suppose you can always deliberately look for a font where the confusion can arise. I've just tested my ancient typewriter (which needs large apostrophes to spread the pressure) and there was no such problem. If you worry about this sort of thing, you can also worry about 0s and Os, ls and 1s, 4s and As, and so on. You can also mistakenly type - instead of _ and it would not be a syntax error. > In proportional fonts, it often is the case that digits are all > the same width. There's a fairly good chance that underscore > will have the same width as a digit, but apostrophe almost > certainly will not, leading to potential alignment problems. > (Admittedly, this is not relevant very often for program > source code. But I think it is relevant often enough to > mention it.) I sometimes want to use leading zeros for the same sorts of reasons. But I can't do that. > Using underscore as a numeric separator character in other > languages, my experience is that having multiple separators > together (mostly two, occasionally three) is helpful writing > (ie, for later reading) long numbers. The C++ apostrophe > separator doesn't allow that (and sensibly so, since > allowing more than one would lead to other problems). What sort of problems? (I can use consecutive apostrophes and it seems to work fine.) > Last but not least, using underscore as a separator fits > easily into existing tools, since underscore is already > allowed as a character in numeric pre-processing tokens. > Using apostrophe instead is more disruptive. Note that > we're not just talking about C compilers here. There are > lots of tools that process C source code, and those would > need to be updated. The changes needed for underscore > are probably mostly done already; the changes needed for > apostrophe are much larger. Outside C, I use both _ and ' (as well as `). I prefer the apostrophes because they are not shifted characters on my keyboard. -- Bartc
Back to comp.lang.c | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: Spurious diagnostic messages Tim Rentsch <txr@alumni.caltech.edu> - 2015-09-10 04:59 -0700
Re: Spurious diagnostic messages Keith Thompson <kst-u@mib.org> - 2015-09-10 12:53 -0700
Re: Spurious diagnostic messages Tim Rentsch <txr@alumni.caltech.edu> - 2015-09-22 05:06 -0700
Re: Spurious diagnostic messages Bartc <bc@freeuk.com> - 2015-09-22 19:00 +0100
csiph-web