From: | Hans-Peter Diettrich <DrDiettrich1@netscape.net> |
Newsgroups: | comp.compilers |
Date: | Wed, 7 Dec 2022 12:13:54 +0100 |
Organization: | Compilers Central |
References: | 22-12-001 22-12-003 22-12-004 22-12-007 |
Injection-Info: | gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="95592"; mail-complaints-to="abuse@iecc.com" |
Keywords: | types, design |
Posted-Date: | 07 Dec 2022 11:45:10 EST |
In-Reply-To: | 22-12-007 |
On 12/6/22 6:56 PM, Keith Thompson wrote:
> Hans-Peter Diettrich <DrDiettrich1@netscape.net> writes:
>> IMO C basic syntax is a bad base. As long as declarations and
>> expressions can be distinguished only by the type of an identifier (type
>> name or variable name) it's not a good idea to add new keywords that can
>> be confused with variable or type names.
Nobody seems to disagree with my opinion?
> Instead weird constructs like
>> "long long" for int64_t have been introduced, while "int int" stays
>> equivalent to "int".
>
> long long and int64_t are not the same (though int64_t may be the same
> type as long long in a given implementation). long long is *at least* 64
> bits. int64_t is *exactly* 64 bits, and must have a 2's-complement
> representation and no padding bits.
You are right, my sloppy wording was not appropriate in this NG :-(
> "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?
It looks to me like additional rules apply which decide that
"long int"
"long long int"
"long int long" //what's that?
are all valid while
"long int long int"
throws an "two or more data types..." error.
In former times it was much easier to decide with a single basic type id
(int...) and type modifiers (long...).
DoDi
Return to the
comp.compilers page.
Search the
comp.compilers archives again.