In Anlehnung an
Duff's Device hab ich meinem
Goto-Labels-In-if(0)-Bloecken-Trick nun den Namen "Clifford's Device" gegeben und
einer Page in meiner Codeing-Fun-Section auf clifford.at gewidmet.
Kleines Beispiel zu Clifford's Device mit switch statt gotos:
#include <stdio.h>
int main(int argc)
{
char *num;
switch (argc-1)
{
if (0) { case 0: num = "zero"; }
if (0) { case 2: num = "two"; }
if (0) { case 3: num = "three"; }
if (0) { case 4: num = "four"; }
if (0) { case 5: num = "five"; }
if (0) { default: num = "many"; }
printf("Called with %s arguments.\n", num);
break;
case 1:
printf("Called with one argument.\n");
}
return 0;
}