Liste des Groupes | Revenir à cl c |
On 12/07/2024 06:53, David Brown wrote:I am not evading it in any way. I answered, and you snipped the answer.On 11/07/2024 22:36, bart wrote:KT has chosen not to answer, and now you are evading it too.On 11/07/2024 21:29, Keith Thompson wrote:>bart <bc@freeuk.com> writes:>>The language could have helped a little by making this invalid:>
>
int A[20];
>
void F(int B[20]) {}
>
The type of B looks just like that of A, but it isn't; the T[N] type
is silently changed to T*. The language could insist that you write:
>
void F(int* B) {}
But it doesn't. Why should we waste time in comp.lang.c explaining how
C *could* have been defined? It's hard enough to explain how it
actually is defined, especially with your contributions.
>This way, it is far clearer that a pointer is being passed, and 'pass>
by value' now makes more sense. The way B will be used is now
consistent with the same declaration anywhere else.
But that's not C.
Why isn't it C?
Are you trying to blame us for how C is defined?
I'm asking why this:Keith did not say anything of the sort.
void F(int* B) {}
is 'not C' according to KT.
To be clear, I was proposing that:And to be clear, no one has said that would be a bad idea (which does not mean that no one /thinks/ it would be a bad idea). But it is not how C is defined as a language, and the C language - its compilers and existing code base - is not going to change on the whims of some guy off the internet who can't be bothered to learn the language properly.
void F(int B[20])
is an error, and requiring people to write:
void F(int* B) {}
instead.
I tried to enforce that in my C compiler, and it was a one-line change. But it can only be used for new programs, and so much existing code uses those value-array declarations, for example:One person's private sort-of-C compiler is of no more relevance to the C community than one person's private language. You are welcome to make as many non-conforming changes to your own tools as you like, but they do not make a difference to C. No one else will ever use your tool, so no one else will ever care about any incompatible changes you make to it. If /you/ are happier having such changes in your tools, then that is great for you.
LUALIB_API int (luaL_checkoption) (lua_State *L, int arg, const char *def,
const char *const lst[]);
Les messages affichés proviennent d'usenet.