Liste des Groupes | Revenir à cl c |
On 30/11/2024 15:57, David Brown wrote:So if we all agree that it's a bad idea, and no one does it, why is it such a problem for you?On 29/11/2024 19:26, Bart wrote:Who said it's a good idea? I merely said that C allows such disparate types in declarations. You disagree that they are different types, while at the same time saying it's a bad idea to mix them in the same declaration!>>
C's syntax allows a 14-parameter function F to be declared in the same statement as a simple int 'i'.
And the laws of physics allow me to drop a 20 kg dumbbell on my toe. That does not mean that anyone thinks it is a good idea.
Are you extrapolating from how /you/ think, to how everyone else (or at least, every other C programmer) thinks? Given the negligible support you have here for most (though not all) of your multitudes of pet hates in C, I think that's a rather bold approach.That's not how people's minds work.I'd say that F and i are different types! (Actually I wouldn't even consider F to be type, but a function.)>
Functions have types in most typed languages, including C.
>
And yes, F and i are different types - but they are related types. Use the declared identifier in an expression of a form matching what you wrote in the declaration, and the expression will have type "int". That's how C's declarations work.
If you declare A, B, and C, then what is important is the types of A, B, and C, not what might yielded as they result of some expression.Why do you think that? After all, A, B and C are going to be used primarily in those types of expression. If "A" is an array, you will use it as "A[i]" in the majority of cases - and care about the type of "A[i]" more than the type of "A".
You are joking, right? If you are not lying about how confusing you find C and how error-prone you think it is, then your C code works by luck. And that is not something people are going to find easy to understand. (And if you are talking about your own language, then no one else understands it.)Why?With the kind of C I would write, you could discard everything after C99, and even half of C99, because the subset I personally use is very conservative.>
>
You say that as though you think it is a good thing - it is not.
I reckon people will have an easier type understanding and working with my code than yours.
It will at least work with more compiles.And why would that matter? No actual developer would care if their code can be compiled by your little toy compiler, or even more complete little tools like tcc. Code needs to work on the compilers that are suitable for the job - compatibility with anything else would just be a waste of effort and missing out on useful features that makes the code better.
Les messages affichés proviennent d'usenet.