Era rimasto un else if
Grazie ad entrambi
Moderatore:
Paolino
switch (var){
case CONDIZIONE_1:
// Codice condizione 1 (senza break alla fine!)
case CONDIZIONE_2:
// Codice condizione 2 (senza break alla fine!)
case CONDIZIONE_3:
// Codice condizione 3
}
void Send(int * to, const int* from, const int count)
{
int n = (count+7) / 8;
switch(count%8)
{
case 0: do { *to++ = *from++;
case 7: *to++ = *from++;
case 6: *to++ = *from++;
case 5: *to++ = *from++;
case 4: *to++ = *from++;
case 3: *to++ = *from++;
case 2: *to++ = *from++;
case 1: *to++ = *from++;
} while (--n>0);
}
}
instead of
(Anonimo).
ain't
, right?
in lieu of
.
for
arithm.

DirtyDeeds ha scritto:Un pezzo di codice celebre che usa questo trucco è il seguente:
- Codice: Seleziona tutto
void Send(int * to, const int* from, const int count)
{
int n = (count+7) / 8;
switch(count%8)
{
case 0: do { *to++ = *from++;
case 7: *to++ = *from++;
case 6: *to++ = *from++;
case 5: *to++ = *from++;
case 4: *to++ = *from++;
case 3: *to++ = *from++;
case 2: *to++ = *from++;
case 1: *to++ = *from++;
} while (--n>0);
}
}
Chi sa a cosa serve?


Shockwaver ha scritto:La Duff's Device...
wizard ha scritto:E' certamente un altro modo di vedere la cosa
instead of
(Anonimo).
ain't
, right?
in lieu of
.
for
arithm.



Torna a Firmware e programmazione
Visitano il forum: Nessuno e 6 ospiti