Liste des Groupes | Revenir à cl c |
On 11/04/2025 10:17, David Brown wrote:Many types of declarations can be repeated, as long as they define the same identifier to be the same thing. If you want the details, they are in section 6.7 of the standard.On 10/04/2025 21:27, bart wrote:On 10/04/2025 20:05, David Brown wrote:Huh? That demonstrates several things:>C rarely makes things more complicated without a good reason.>
C usually makes things more complicated without a good reason!
Nope.
>>>
Here's one example, of dozens, of perfectly legal C:
>
long unsigned const long const const typedef int A;
int long unsigned const long const const typedef A;
long unsigned const long const typedef int A;
.....
>
That is not more complicated, nor is it without good reason.
1 That the same identifier can be redeclared multiple times
2 That 'typedef' needn't be on the left, but can be anywhere in the middle of a type specCorrect. Putting it anywhere other than the left may be disallowed sometime in the future (it is an "obsolescent feature"), but it is currently supported in C.
3 That 'const' can also be anywhere inside the type specCorrect.
4 That duplicate 'const's are toleratedCorrect.
5 That the three tokens ('int', 'unsigned' and two 'long's) denoting the type can be be any order (and mixed up with other attributes)Correct.
I missed out:No one suggested it was at all necessary.
6 'int' can be optionally omitted in this case.
That makes it pretty complicated to me! And I can't see that any of these are necessary.
Les messages affichés proviennent d'usenet.