Defect Report #337

Previous Defect Report < - > Next Defect Report
 

Submitter: Nick Stoughton (US)
Submission Date: 2007-02-28
Source: Austin Group

Version: 1.4
Date: 2007-10-30
Subject: stdio.h macro definition problems

Summary

The BUFSIZ macro is introduced in 7.19.1 para 3 as

BUFSIZ
which expands to an integer constant expression that is the size of the buffer used by the setbuf function

There is no requirement that BUFSIZ should be a non-zero, positive integer constant expression. Such a requirement should be spelled out clearly.

The same is true for FOPEN_MAX and FILENAME_MAX.

Suggested Technical Corrigendum

Change the definition of BUFSIZ to:

BUFSIZ
which expands to a non-zero, positive integer constant expression that is the size of the buffer used by the setbuf function
Similarly,
FOPEN_MAX
which expands to a non-zero, positive integer constant expression that is the minimum number of files that the implementation guarantees can be open simultaneously;

FILENAME_MAX
which expands to a non-zero, positive integer constant expression that is the size needed for an array of char large enough to hold the longest file name string that the implementation guarantees can be opened;


Committee discussion

Spring 2007

FOPEN_MAX is required to be at least 8, see 7.19.3 paragraph 13. So FOPEN_MAX does not require any additional words.

BUFSIZ likewise must be at least 256, see 7.19.2 paragraph 7.

FILENAME_MAX 7.19.1 paragraph 3 requires that FILENAME_MAX must be at least 1.

Proposed Committee Response

All of these constants already have required minimum values that are positive, non-zero. No changes are required.


Previous Defect Report < - > Next Defect Report