Liste des Groupes | Revenir à cl c |
Bart wrote:the calling sign shuld be needed as as for years i wanted to do something likeOn 03/11/2024 00:26, fir wrote:>Bart wrote:>...>
as to this switch as i said the C jas some syntax that resembles
switch and it is
>
[2] { printf("one"), printf("two"), printf("three") }
>
i mean it is like this compound sometheng you posted
>
{ printf("one"), printf("two"), printf("three") } [2]
>
but with "key" on the left to ilustrate the analogy to
>
swich(n) {case 0: printf("one"); case 1: printf("two"); case 2:
rintf("three") }
>
imo the resemblance gives to think
>
the difference is this compound (array-like) example dont uses defined
keys so it semms some should be added
>
[n] {{1: printf("one")},{2: printf("two")},{3: printf("three")} }
>
so those deduction on switch gives the above imo
>
the question is if some things couldnt be ommitted for simplicity
>
[key] {'A': printf("one"); 'B': printf("two"); 'C': printf("three"}; }
>something like that>
>
(insted of
>
switch(key)
{
case 'A': printf("one"); break;
case 'B': printf("two"); break;
case 'C': printf("three"}; break;
}
>
Here the switch looks clearer. Write it with 300 cases instead of 3,
then that becomes obvious.
>
depend on what some understoods by clearer - imo not
>
this []{;;;} at least is like logically drawed from other c syntax
>
and switch case overally the word case is ok imo but the word switch is
overrally like wrong imo switch could be better replaced by two
word "select" and maybe "goto" as this swich that selects could use
select and this one wgo does goto could use word goto
>
goto key;
'A': printf("a");
'B': printf("b");
'C': printf("c");
'
>
overally thete is lso possibility to do it such way
>
void foo()
{
>
"a" { printf("aaa"); } //definitions not calls itself
"b" { printf("bbb"); }
"c" { printf("ccc"); }
>
>
"a";"b";"c"; //calls (???)
// would need maybe some some syntax to call it (many could be chosen)
>
// "a"() ? foo."a" ? foo.[key] ?
>
maybe this woudl be the best if established as ths is more syntaktc "low
lewel"
>
}
>
Les messages affichés proviennent d'usenet.