Path: csiph.com!usenet.pasdenom.info!gegeweb.org!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: Spurious diagnostic messages Date: Fri, 22 May 2015 08:38:15 -0700 Organization: None to speak of Lines: 86 Message-ID: <87vbfksjvc.fsf@kst-u.example.com> References: <55586ec4.5718781@news.xs4all.nl> <662af1c4-4aff-4810-9a67-b913281fab59@googlegroups.com> <874mn5ty3y.fsf@kst-u.example.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="9be37d943435275679235b07c7947eef"; logging-data="15053"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+0rxtpEDlXnNSv6uEdm2xQ" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:wSPLxWI77yIM+iwmaWxbNCnPKQk= sha1:zKLMUSPSfRw4zGq5U6cqLgUXY90= Xref: csiph.com comp.lang.c:62448 Bartc writes: > On 21/05/2015 22:33, Keith Thompson wrote: [...] >> 8 Numeric literals can have separators (either _ ' or `) >> >> I can imagine ' and ` causing syntactic ambiguities. If I were >> designing a language (I'm not), I'd just use a single character; I don't >> see providing multiple choices as an advantage in this particular case. > > Yeah, but which one? Allowing several means that data source can be > pasted directly from other languages; some might use ', others _ If there are three different ways to write a numeric literal, programmers are going to use all three. In my opinion, that's not a good thing, and the minor advantage of the added flexibility is IMHO outweighed by the potential confusion. A minor point; Markdown uses the backtick to delimit code. Using it as part of your language syntax could make it slightly more difficult to discuss in some forums. Of course it's your language, and my opinion probably shouldn't count for much. >> 9 Large integer literals don't need L LL or other suffixes except to >> designate type >> >> How does that differ from C? For example, an unsuffixed decimal >> constant is of type int, long int, or long long int, depending on its >> value. > > TBH I don't know exactly what the rules are in C. I know that > sometimes odd compiler errors go away if I put a suffix in. It can be necessary in expressions. For example `1000 * 1000` will overflow if int is 16 bits; you can write `1000L * 1000L` to avoid that. >> 11 Exact-width integer types can be specified via syntax, as int:N >> for N bits, or int*N for N bytes wide. >> >> Another case where multiple options are IMHO not helpful. I'd probably >> stick to the ":N" syntax. (I presume N has to be a constant?) > > Again, this allows people to choose a style they prefer. So long as > it's consistent within the same code, I can't see that it's a > problem. It *won't* always be consistent within the same code, unless each program is written by one and only one person who never changes his or her mind. > So a 32-bit signed int can be expressed as any of: > > int:32 int*4 int32 i32 > > Don't forget that C also allows: > > int, signed int, int signed, signed and int32_t > > (with even more variations if you introduce long, short, unsigned and > const.) int32_t doesn't belong in that list. Again, in my opinion a language shouldn't provide multiple ways to express the same thing *unless* there's some real expressive advantage to doing so. If there's only one way to do it, code is easier to read. (Ironically, I'm a big fan of Perl, whose motto is TMTOWTDI, "There's more than one way to do it". I never claimed to be entirely consistent.) [...] > It's too easy designing something and ending up with something like > Ada! I think the designers of Ada would disagree with that! [...] -- 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"