Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Replaced void MSC31 in first paragraph with 3-bullet list of superseding guidelines; please check that all are applicable

Avoid in-band error indicators while designing interfaces. This practice is commonly used by C library functions but is not recommended. One example from the C Standard of a troublesome in-band error indicator is EOF. (See void FIO34-C. Use int to capture the return value of character IO functions that might be used to check for end of file and void FIO35-C. Use feof() and ferror() to detect end-of-file and file errors when sizeof(int) == sizeof(char).) Distinguish between characters read from a file and EOF or WEOF). Another problematic use of in-band error indicators from the C Standard involving the size_t and time_t types is described by VOID MSC31by 

...

...

Noncompliant Code Example (sprintf())

...