C言語なら、オレに聞け! <4>

このエントリーをはてなブックマークに追加
325sage
どれがお好み?

while (fgets(buf, sizeof(buf), fp) != NULL) {
  if (buf[0] == ';') {  // skip comment line
    goto continue_loop;
  }

  /* normal task */

continue_loop:
  ;
}


while (fgets(buf, sizeof(buf), fp) != NULL) {
  if (buf[0] == ';') {  // skip comment line
    continue;
  }
  else
  {
    /* normal task */
  }
}

while (fgets(buf, sizeof(buf), fp) != NULL) {
  if (buf[0] != ';') {  // skip comment line
    /* normal task */
  }
}

while (fgets(buf, sizeof(buf), fp) != NULL) {
  if (buf[0] == ';') {  // skip comment line
    continue;
  }

  /* normal task */
}