Path: csiph.com!weretis.net!feeder6.news.weretis.net!news.misty.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end From: Keith Thompson Newsgroups: comp.compilers Subject: Re: What attributes of a programming language simplify its use? Date: Wed, 07 Dec 2022 17:53:19 -0800 Organization: None to speak of Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <22-12-011@comp.compilers> References: <22-12-001@comp.compilers> <22-12-003@comp.compilers> <22-12-004@comp.compilers> <22-12-007@comp.compilers> <22-12-010@comp.compilers> MIME-Version: 1.0 Content-Type: text/plain Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="68388"; mail-complaints-to="abuse@iecc.com" Keywords: C, types, history Posted-Date: 08 Dec 2022 13:57:51 EST X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com Xref: csiph.com comp.compilers:3258 Hans-Peter Diettrich writes: > On 12/6/22 6:56 PM, Keith Thompson wrote: [...] >> "int int" is a syntax error. > > I could not find in the (older) C++ grammar why "int int" should be a > *syntax* error. Aren't both "int" and "long" simple-type-specifier's > which can occur multiple times in a decl-specifier-seq? No, there are specific rules that specify the way they can be used. In the 2011 ISO C standard standard (I use the draft from https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf), the valid type specifiers are listed in section 6.7.2. At least one type specifier shall be given in the declaration specifiers in each declaration, and in the specifier-qualifier list in each struct declaration and type name. Each list of type specifiers shall be one of the following multisets (delimited by commas, when there is more than one multiset per item); the type specifiers may occur in any order, possibly intermixed with the other declaration specifiers. The list includes entries: - int, signed, or signed int - long long, signed long long, long long int, or signed long long int among others. There are no entries in which the keyword "int" appears more than once. (The C99 standard incorrectly referred to these as "sets" rather than "multisets", which preserve the number of times each element occurs. The word "sets" was correct in C90, which didn't have long long.) [...] > In former times it was much easier to decide with a single basic type id > (int...) and type modifiers (long...). int and long are both keywords that are type specifiers, but they differ in how they can be used. It's tempting to think that the "long" in "long int" qualifies the type name "int", and that's probably how it originated, but that's now how the language standard specifies it. C++ has equivalent rules, stated a bit differently. (C introduced long long in 1999, C++ in 2011.) -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com Working, but not speaking, for XCOM Labs void Void(void) { Void(); } /* The recursive call of the void */