Liste des Groupes | Revenir à cl c |
On 16.04.2025 16:31, bart wrote:It highlights three things that C manages to make quite a meal out of, despite them being trivially fixable even in such a low-level language:On 16/04/2025 13:08, Michael S wrote:You should be aware that [simple] linear iterations are conceptually[...]>
When languages used to be 1-based, it was easy. Then 0-based came along,
and typically iteration changed from 1..N inclusive, to 0..N-1 inclusive.
coupled to arrays. The choice of 0-based arrays and thus iterations is
"useful" for compiler creators of such languages. They allow without
overhead and skill for optimization an efficient array access.
[...](This all exposes quite clearly the low-level characteristics of "C".)Oh, now you could interpret a written above as statement of superiority>
of C syntax. So, no, it is not. Those are *minor* points.
Here's some C code to print the elements of an array:
>
static char* table[] = {"one", "two", "three", "four", "five"};
>
for (int i=0; i<sizeof(table)/sizeof(table[0]); ++i)
printf("%d %s\n", i, table[i]);
for i, s in table doSure, many language support newer syntaxes for such things. Even older
println i, s
end
>
To me, the differences in that for-loop are like chalk and cheese.
languages do such abstractions; e.g. Awk[*]
split ("one two three four five", table)
for (i in table)
print i, table[i]
(One of many things I like in this very small but powerful language.)I had to check your claims:
Les messages affichés proviennent d'usenet.