Shorts from an old harddrive

So cleaning out an old hard drive and found a text file with examples I had seen while I was consulting. The file was from 2002 so hopefully all this code has been retired.

  1. #defines instead of actual numbers in code are generally a good idea but this is pushing it.

    #define SCC_ZERO 0 #define SCC_ONE1 1 #define SCC_8000 0x8000 #define SCC_C0FF 0xC0FF

  2. More from the same code here implying that the compiler can distinguish between 0x0000 and 0x00000000 .

    #define BP_ZERO16 0x0000 #define BP_ZERO32 0x00000000

  3. The original code had almost all 26 letters of the alphabet in use but I think you get the point. Now I'm envisioning this started with just a couple options but at some point that indentation would have driven me insane.

    if(strcmp(arg,'-a')==0) { .... } else { if (strcmp(arg,'-b')==0) { .... } else { if (strcmp(arg,'-c')==0) { .... } else { if (strcmp(arg,'-d')==0) { .... } else { if (strcmp(arg,'-e')==0) { .... } ........... } } } }

  4. In some Specman 'e' Code (an obscure dying language):

    case foo { 000;{ xyz = 0; };
    001;{ xyz = 1; };
    002;{ xyz = 2; };
    003;{ xyz = 3; }; ... 063;{ xyz = 63; }; }

Posted Mar 15, 2018, 3:41 PM UTC

170

No comments yet

Nobody commented on this post, or the comments weren't captured.