mercredi 22 février 2017

What is the purpose of "#if 0 ...#endif" declaration

now I'm confused again. In our old C-code I've found some strange parts, a dump function that seems to print to terminal and I wonder if you can explain why this "#if 0" is used?

My guess is that this is an old way to comment out code....

#if 0
dump(b, cnt)
     char *b;
     int cnt;
{
  int i;

  if (cnt == 0)
    return;

  for (i=0; i < cnt; i++, b++){
    if ((i % 16) == 0)
      printf("\n");
    printf("0x%02x ", *b);
  }
}
#endif

Aucun commentaire:

Enregistrer un commentaire