Liste des Groupes | Revenir à cl c |
If you say stupid things, repeatedly,
Start applying a bit of your intelligence (you say stupid things sometimes, but I know you are far from stupid), and you'll find the level of conversation going up.You are spectacularly missing the point. IT DOESN'T WHOSE TOOL IT IS. Somebody could have done the same exercise with gcc, and come to the same conclusion: too many programs use array parameters.
I made the tweak to see how hard it would be to detect value-arrays declared in parameter list (it was very easy), and what the consequences would be on existing code (significant).No, the consequences are non-existent because no one uses your tool, and no one will ever copy that change in other tools (of significance).
What WOULD be the effect if a compiler did that? How would a particular codebase be affected?>You can write your code the way you want to write it - it will not change the way anyone else writes their code. It really is that simple. Why is this so difficult for you to understand?
The example I posted showed a type (const char* x[]) where there was no advantage to having that value array notation. Using 'const char**' would be a more accurate description of the actual parameter type.
>
Do you really suppose that if /you/ make "foo(char x[])" a syntax error in /your/ compiler, it will have the slightest effect on how other people write their C code?
Or on what other C compilers do? Or on how half a century of existing C code is written?gcc could conceivably have an option that detects and warns about that. Whoever is thinking about doing that might well do a test exactly like mine.
Personally, I don't like that C allows something that /looks/ like arrays can be passed to functions, but doesn't work that way.
I don't think I have ever written a function with an array-like parameter - I use a pointer parameter if I mean a pointer, or have the array wrapped in a struct if I want to pass an array by value.So all /your/ code would still pass; great!
But I don't think my opinions make a difference to C, and even if I were elected dictator of C for a day, I don't think my opinions should count more than any one else's - including those that like the way C works hereHalf of the programming language you call "C" is defined by the way you invoke your compiler. So that already allows for myriad, slightly different dialects.
And I don't confuse my opinions or preferences with how C actually works and how it is actually defined, and I certainly don't spread such confusions and misunderstandings to others.C does that well enough by itself. There are any number of behaviours where: (1) saying nothing and passing; (2) warning and passing; (3) reporting an error and failing are all perfectly valid.
Les messages affichés proviennent d'usenet.