Liste des Groupes | Revenir à cl c |
On 06/11/2024 15:40, Bart wrote:
There are irrelevant differences in syntax, which could easily disappear entirely if a language supported a default initialisation value when a return gives no explicit value. (i.e., "T foo() { return; }; T x = foo();" could be treated in the same way as "T x;" in a static initialisation context.)You wrote:
Then you list some things that may or may not happen, which are of course totally irrelevant. If you list the differences between bikes and cars, you don't include "some cars are red" and "bikes are unlikely to be blue".Yes; if you're using a vehicle, or planning a journey or any related thing, it helps to remember if it's a bike or a car! At least here you acknowledge the difference.
It's a pointless distinction. Any function or procedure can be morphed into the other form without any difference in the semantic meaning of the code, requiring just a bit of re-arrangement at the caller site:
int foo(int x) { int y = ...; return y; }
void foo(int * res, int x) { int y = ...; *res = y; }
void foo(int x) { ... ; return; }
int foo(int x) { ... ; return 0; }
There is no relevance in the division here, which is why most languages don't make a distinction unless they do so simply for syntactic reasons.As I said, you like to mix things up. You disagreed. I'm not surprised.
void F();In C, the syntax is dreadful: not only can you barely distinguish a function from a procedure (even without attributes, user types and macros add in), but you can hardly tell them apart from variable declarations.As always, you are trying to make your limited ideas of programming languages appear to be correct, universal, obvious or "natural" by saying things that you think are flaws in C. That's not how a discussion works, and it is not a way to convince anyone of anything. The fact that C does not have a keyword used in the declaration or definition of a function does not in any way mean that there is the slightest point in your artificial split between "func" and "proc" functions.
(It doesn't matter that I too prefer a clear keyword for defining functions in a language.)Why? Don't your smart tools tell you all that anyway?
That is solely from your choice of an IL.The IL design also falls into place from the natural way these things have to work.
Of course you are wrong!You keep saying that. But then you also keep saying, from time to time, that you agree that something in C was a bad idea. So I'm still wrong when calling out the same thing?
If there was an alternative language that I thought would be better for the tasks I have, I'd use that. (Actually, a subset of C++ is often better, so I use that when I can.)What makes you think I'm whining? The thread opened up a discussion about multi-way selections, and it got into how it could be done with features from other languages.
What do you think I should do instead? Whine in newsgroups to people that don't write language standards (for C or anything else) and don't make compilers?
Make my own personal language that is useless to everyone else and holds my customers to ransom by being the only person that can work with their code?Plenty of companies use DSLs. But isn't that sort of what you do? That is, using 'C' with a particular interpretation or enforcement of the rules, which needs to go in hand with a particular compiler, version, sets of options and assorted makefiles.
Les messages affichés proviennent d'usenet.