G. Branden Robinson wrote in <20180626153737.mf72sv3paetlc...@crack.dead\ beast.net>: |I enjoyed this Easter egg; maybe you will too.
Why easter egg if i might ask? |src/preproc/refer/refer.cpp: ... | while (opt != 0 && *opt != '\0') { | switch (*opt) { ... | case '-': | if (opt[1] == '\0') { | finished_options = 1; | opt++; | break; |} | if (strcmp(opt,"-version")==0) { | case 'v': // <-- a gibbon on the syntax tree I often use this kind of code and am very thankful that C allows this. I would not exactly call it easter egg, if you would program this in assembler it would look much more natural than here with the brace groups. But interesting that you call it Duff's device, i thought that exactly refers to a do..while() loop within a switch!, as in uir szloop = (_bufsize + 8-1) >> 3; // do an odd switch and then 8 bytes at a time with Duff's // device instead; saves CMP's and conditional branches. switch(_bufsize & (8-1)) { case 0: do { _HASH(ret, *(buf++)); case 7: _HASH(ret, *(buf++)); case 6: _HASH(ret, *(buf++)); case 5: _HASH(ret, *(buf++)); case 4: _HASH(ret, *(buf++)); case 3: _HASH(ret, *(buf++)); case 2: _HASH(ret, *(buf++)); case 1: _HASH(ret, *(buf++)); } while(--szloop); } | printf("GNU refer (groff) version %s\n", Version_string); ... --steffen | |Der Kragenbaer, The moon bear, |der holt sich munter he cheerfully and one by one |einen nach dem anderen runter wa.ks himself off |(By Robert Gernhardt)