Liste des Groupes | Revenir à cl c |
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!>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.
C's syntax allows a 14-parameter function F to be declared in the same statement as a simple int 'i'.
That's not how people's minds 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.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.
Really, most of this is pretty straightforward. No one is asking you to /like/ the rules of C's declarations (I personally dislike that a single declaration can be used for different types, even if they are related). But /please/ stop pretending it's difficult to understand.I keep saying that my language is easier than this with simpler rules. That makes C harder. It also makes it more errorprone. It can make it more confusing. That is just the truth.
>And you seem utterly incapable of understanding that A implementing some complicated and badly designed system X doesn't mean that A becomes an expert in using X, or suddenly thinks of it as simple and well-designed.I am not implementing the language. No one else here is implementing it. You have, apparently, implemented at least some of the language while being completely incapable of understanding it.C allows this, but I personally would be happier if it did not. As Michael says below, most serious programmers don't write such code.>
It doesn't matter. If you're implementing the language, you need to allow it.
/That/ is how you solve problems with syntax that can be abused to write unclear code.You solve it by fixing the language. If you can't fix the language then you use a strong workaround, such as a new syntax wrapper around 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.
>
Les messages affichés proviennent d'usenet.