Liste des Groupes | Revenir à cl c |
bart <bc@freeuk.com> writes:>
Rubbish. Everyone finds C declaration syntax a nightmare.
Because of "C"'s somewhat convoluted (IMO "bad") syntax it mightThis is a third kind of workround. All of them should be unnecessary. Unless the type really is complicated and needs to be decomposed anyway, whatever the syntax.
help you to make use of 'typedef's to incrementally construct your
types!
I 100% agree with what C is capable of as a systems language. The level of its type system, its size, its scope, its flexibility (to an extent)C type syntax is just not fit for purpose.Reality shows that it *is* (de facto) "fit for purpose". (Probably
not yours. - I'm still wondering why you act in a "C" newsgroup.)
I gave the full English description further up.This is not how a language isI agree that language designers can do a much better job. (There's
meant to work, and this is not supposed to be the hard part of a
language! Syntax should be the easy bit.
quite some examples for languages with an IMO "better" syntax.)
>My English might not be good enough, but in my book this is not an
This is that English spec (with the significant bits numbered):
>
array 10 pointer to func take int return int
English sentence and for me not (not much)
Guessing: An array with 10 elements that are pointers to functionsVery good. It's not a guess though is it? If you extract the essential parts out, you get:
that take an 'int' parameter and return an 'int' value?
Not necessarily. This is a valid declaration in C:1 2 3 4 5 6(This opening parenthesis syntactically indicates the function, as
>
Here is what CDECL came up with:
>
int (*A[10])(int);
6 3 1 2 4 5 (Not sure which bit is the '4')
also indicated by the numberings above. - Or so I'd think. - No?)
>And what should that mean? - You know, since I haven't identified
The numbers below show the correspondence with the English. You can see
it's all over the place. This is how I'd write it in another actual
language syntax:
>
[10]ref func(int)int A
1 2 3 4 5 6
your "English sentence" as a clearly understandable English sentence
I'm lost here, since I don't know that (your?) language. - For theA could of years ago I had a bit of fun with it so that my allowed this syntax:
"C" case I could at least read the "C" specs (in case I got lost).
Assumed that my guess above was correct that's quite equivalent toSo you do get it (maybe I should have read this far first). Yes, it directly comes from Algol68.
the Algol 68 form
[10] REF PROC (INT) INT a
but in Algol 68 you'd probably rather use it without the unnecessaryThis is not as clear; the intent is to have a reference to a function; not an array of actual functions. For example:
"pointer"/reference just as in
[10] PROC (INT) INT a
which - as you seem to like clearness - is even simpler!
Les messages affichés proviennent d'usenet.