REPORT ON THE ISO/IEC/JTC1/SC22/WG14 MEETING AT MENLO PARK, CALIFORNIA 20th to 24th October 1997 Clive D.W. Feather Principal UK Expert and Head of UK Delegation [Despite my position at the meeting, this is an unofficial report. Opinions expressed here are my own.] Introduction ============ This meeting was the last one before the Committee Draft of the revised Standard for C (usually referred to as C9X) is issued. The majority of the meeting was spent considering papers that propose wording changes for the draft. An outline of the meeting process is that there were a number of papers written prior to the meeting that were intended for consideration. Each paper was discussed; the changes it proposed might be accepted directly, rejected, accepted with modifications, or sometimes the committee felt that an alternative approach was preferable. In this case, sometimes a further paper was presented at the meeting, and sometimes words were inserted directly into the minutes. Formally, there was a meeting of technical experts, a meeting of J11 (the group working on C on behalf of ANSI and formerly known as X3J11), and a meeting of WG14 itself all going on at the same time. Discussion would take place, and straw votes of the technical experts might be taken for guidance. When a formal decision was required, a J11 vote was taken and recorded, and the result used as guidance by the US representative. A WG14 vote was then held, which decided the final outcome of the matter. [J11 has, I understand, 17 voting members (companies or individuals) at present, of whom up to 14 were represented at various times during the week. J11 votes required more "yes" than "no" votes to pass a motion.] [SC22 has 24 voting members: Australia, Austria, Belgium, Brazil, Canada, China, Czech Republic, Denmark, Egypt, Finland, France, Germany, Ireland, Japan, Netherlands, Norway, Romania, Russia, Slovenia, Sweden, Switzerland, UK, Ukraine, and the USA. Three - Denmark, UK, and USA - were represented at this meeting. The Convenor of WG14 is normally of the opinion that consensus has been reached on a matter if either no country disapproves of a motion, or at least two approve of it and no more than one country disapproves. Thus here votes of 1/0/2 (approve/disapprove/abstain), 2/0/1, 2/1/0, and 3/0/0 represent consensus.] The specific votes are not recorded here, though they are in the minutes. Matters are not listed in this report in the order they were discussed. Papers with numbers up to N780 were circulated in print prior to the meeting, and paper N781 was circulated by email. Papers N782 to N793 were written, printed out, and circulated at the meeting, with the exception of N787 which is the official minutes and has not yet been circulated. [I have, however, checked that the actions listed in this report match those recorded in the official minutes.] Though the papers are or will be available publically via HTTP, I have summarized their contents here. In the case of papers I have written, they will be available at before the end of October 1997. Previous Committee Draft ======================== A previous Committee Draft has been registered with SC22 (this was done mostly for procedural reasons, and it is known that the revision was not complete). Voting was 14 approve, 1 disapprove, 3 abstain, 6 did not send a vote (details are in N746). Two countries made comments: Japan and Denmark. Since Denmark voted disapproval, it is particularly important to consider their comments. There were four matters that they feel should be addressed by C9X and were not in the draft. Two of them - POSIX alignment with strftime() and Boolean type capabilities - have, in our opinion, been addressed. The other two - POSIX alignment of internationalization functionality and basic hardware IO functionality - were considered at this meeting. Of the Japanese comments, their request to make long long and the complex types optional were not accepted, and their remaining comments were replied to; in some cases we have invited specific proposals. An initial response to this reply is found in N786. Technical papers accepted ========================= The following technical papers were accepted and thus the appropriate changes will be made to the draft. Some minor adjustments to the paper are not listed here. N725 replaces 6.2.1.2 (conversions among signed and unsigned integer types) with a much simpler set of rules. N727 recommends replacing the term "integral" by "integer" throughout the Standard wherever it refers to integer types. It is left alone when used in a wider sense (such as "integral power" of a number). N757 makes two changes related to floating-point functions. The first was an attempt to resolve the discrepancies between various existing versions of the scalb() function. However, this function has now been deleted from the Standard. The second allows the various macros in to be other than powers of 2 so long as all bitwise-OR combinations remain distinct, and was approved. N759 addressed a perceived problem with the wording on compound literals; one possible reading would be an undue burden on implementers. After consideration, it was agreed that recent changes in 6.1.2.4 (scope and lifetime rules) have addressed the issue. Nonetheless, the example in the paper was added to the Standard. N760 edits 6.8.3 paragraph 4 (function-like macros) to correctly handle both variable argument macros (added in N707) and empty macro arguments (added in N570). N762 addresses 26 separate minor items in previous drafts. The following were approved: 5: correct typographic errors and remove a bad example 7: allow trailing commas in enumerator declarations: enum e { e1, e2, e3, }; 13: item 13.3.2.1 only was accepted, allowing sig_atomic_t to have a volatile-qualified type (see also N768) 14: the error handling discussion in 7.7 was moved to the start of the subclause 15: corrects the definition of the gamma() function 17: returning from SIGILL and SIGSEGV handlers, like SIGFPE, is undefined (later subsumed into N789) 18: wording adjustment in signal handling (later replaced by N789) 20: allow %lf, %lg, etc. in *printf(), with the l being ignored 21: items 21.2.2 and 21.2.3 only: wording fixes in *scanf() 22: allow %hhd, %hhu etc. in *printf() and *scanf, applying to signed char and unsigned char values 24: wording adjustment for the strtod() function Item 12 was agreed to be necessary in principle, but better wording was needed; this is still outstanding. The remaining items in the paper were withdrawn either because they had been dealt with elsewhere or were not acceptable. As part of discussing item 11, the last constraint of 6.8.1 (conditional inclusion) was removed as being unnecessary. N764 (as amended by N781) makes a number of changes to the facilities in the header. Part A addresses problems with the ISO 8601 week facilities added in N733, bringing them into line with common practice. Parts B, F (option Fc), and G clarify various issues with the strftime() function. Part C removes the erroneous suggestion that a minute can be 62 seconds long (the actual maximum is 61), and part E provides a new %z conversion that gives the time zone in "+0100" notation. Part D was felt to be unnecessary, and part H was replaced by N793. N765 tidies up the wording of 6.1.2.8 (representations of values) and requires the types intmax_t and uintmax_t to be provided, allowing a simplification of the wording of 6.8.1 (preprocessor arithmetic). Paper N769 contains more extensive rationale for the latter change. N766 alters the rules concerning inline functions with external linkage. Such functions can now refer to objects with static storage duration that are not modifiable, and the rules concerning the ordering of declarations of such functions have been loosened: in particular, the meaning of a definition such as: inline int add (int x, int y) { return x + y; } can be altered by a later declaration: extern int add (int x, int y); (with the second line the first line becomes an external definition). This allows the first line to be conveniently enclosed within a header file, but potentially affects the implementers of one-pass compilers. Some other (but not all proposed) wording adjustments were made. N767 was another paper addressing assorted issues, 17 this time. The following were approved: 3: complex types have the same representation as a two element array of the corresponding real type, not a two member structure 4: 6.1.2.5 (types) mentions restrict 5: all pointers to structures explicitly have the same representation and alignment, similarly all pointers to unions 6: the term "completed" is now used consistently 8: wording in 6.1.2.8.1 on accessing trap representations was improved 10: the wording of a footnote was clarified 11: wording on integer to pointer conversion was improved 12: incomplete types are no longer described as object types 14: the wording "all pointers to character types are correctly aligned" was removed from a footnote 15: "named members" was replaced by "members" in two places 16: the wording of an example was improved 17: an erroneous example was corrected, and another improved As part of the discussion a constraint and example in 6.5.2 (type specifiers) concerning variably modified types was moved to 6.5.5.2 (array declarators). N768 proposed some 15 wording adjustments. Of these, 11 were accepted in some form, 3 were withdrawn as being dealt with elsewhere, and the last was subsumed into N785. N770 discussed the relationship between multibyte characters and trigraphs, something that was not clearly addressed up to now. A new wording has been adopted for Translation Phase 1: Physical source file multibyte characters are mapped to the source character set (introducing newline characters for end-of-line indicators) if necessary. Any multibyte source file character not in the basic source character set is replaced by the universal- character-name that designates that multibyte character [6]. Then, trigraph sequences are replaced by the corresponding single character internal representations. N772 allows portable header file names to be up to 8 characters long before any dot, rather than 6, and allows digits other than as the first character. N773 collected together some 21 outstanding items from previous papers that make minor wording changes for consistency and clarification; many such changes are in response to Defect Reports. 15 of the items were accepted; the most significant two eliminate register arrays and clarify that letters can be uppercase, lowercase, both at once, or neither. Item 5 was rejected, and items 6, 8, and 18 were withdrawn as having been done elsewhere. Item 13 was replaced by N789, while item 14 (to do with va_list pointers) was accepted but as a footnote rather than normative text. N774 collected together some 19 further outstanding items from previous papers that make minor changes to the Standard to better reflect common practice; again many such changes were taken from Defect Reports. The following items were accepted: 1: the wording of 6.2.1.7 (the usual arithmetic conversions) was improved (some wording is not that suggested in N774) 3: the wording in 6.3.2.3 for function calls without prototypes has the following new words: ... the types of the arguments after promotion are not compatible with those of the parameters after promotion, the behavior is undefined except for the following cases: - one promoted type is a signed integer type, the other promoted type is the corresponding unsigned integer type, and the value is representable in both types; - one type is pointer to void and the other is a pointer to a character type. 4: clarify that, e.g. struct { int x; }; requires a diagnostic because nothing usable is declared 5: replaces 6.5.2.3 (structure and union tags) with better wording 6: arrays of incomplete types like (int [][]) require a diagnostic 7: function parameters may have incomplete type in a prototype, but not in the function definition 10: system headers must use prototypes for standard library functions 13: locale information strings must handle shift states sensibly 14: the heading "environmental constraint" in the definition of setjmp() is renamed "environmental restriction" for clarity 15: setvbuf() may be called again if a call fails 17: the definition of strerror() was changed to: The strerror function maps the number in errnum to a message string. Typically, the values for errnum come from errno, but strerror shall map any value of type int to a message. The following items were withdrawn as being unnecessary: 2, 8, 9, 11, 12, 16, 18, 19. N775 requires unsigned integer types to have the same subrange requirements as signed types already have (for example, unsigned int must be a subrange of unsigned long). N776 changes part of the definition of the fseek() function to: After determining the new position, a successful call to the fseek function undoes any effects of the ungetc function on the stream, clears the end-of-file indicator for the stream, and then establishes the new position. N777 changes the definition of the fgetc() function to: If a next character is present from the input stream pointed to by stream, the fgetc function obtains that character as an unsigned char converted to an int and advances the file position indicator for the stream (if defined). and the fgetwc() function to: If a next wide character is present from the input stream pointed to by stream, the fgetwc function obtains that wide character and advances the file position indicator for the stream (if defined). N779 contained a large number of notes concerning the editing of previous papers into the draft, and was dealt with without any formal motions. N780 proposes a number of changes in the internationalization arena to bring C closer to POSIX (though there are some reports that this paper does not correctly reflect the current situation within POSIX). Some clarifications were made to the to*lower() and to*upper() functions, a formal reference to POSIX was added, and a table showing the relations between the various character classification functions will be added to the Rationale. The proposed is*blank() functions were deemed to be too weakly defined to be useful, and the changes to the currency formatting strings in were not accepted. N782 was a rewrite of N730 after some errors were noted. It allows initializers for automatic lifetime aggregate and union variables to use non-constant expressions; at present this can effectively be done using compound literals but at the cost of an apparently redundant cast: int x, y; /* ... */ struct s { int a, b; }; struct s s1 = (struct s) { x, y }; // valid struct s s2 = { x, y }; // forbidden N783 was a third collection of 16 outstanding items from previous papers, this time addressing major issues or ones requiring large wording changes. 9 of the 16 items were addressed and 5 were accepted: 3: corrects the wording limiting the width of bit-fields 6: a program may #undef macro names reserved by the Standard, other than those beginning with underscore 7: the formatted input/output functions (such as *printf() and *scanf()) shall behave as if there were a sequence point after the actions associated with each conversion specifier, so code like: printf("%n %n",&i,&i); is permitted 10: wording is to be added to the rationale better describing stdio buffering issues, and it was agreed that visibly asynchronous I/O is not permitted by the Standard 13: new wording places requirements on the comparison functions used by the bsearch() and qsort() functions; in particular, they may not alter the array being searched/sorted, must behave consistently, always receive pointers into the array as arguments (and not pointers to cached copies of array elements), and can call Standard library functions except the one that called them Item 4 was withdrawn as having been addressed elsewhere, and item 5 was expanded on in N791. There was no perceived demand for item 8, and item 9 was felt to be better addressed by SC22/WG20. N785 changes the definition of the term "definition" to bring it into line with uses of the term "define" - typedef names and enumeration constants now have a definition even though no storage is reserved. N786 was further general comments from Japan related to their previous balloting comments. Some of the (minor) suggested changes are being done. N788 (and N761 before it) is a rewrite of . The important changes are that the two types intfast_t and uintfast_t have been removed, macros defining the minimum and maximum values of size_t, ptrdiff_t, sig_atomic_t, wchar_t, and wint_t have been added, and all of the macros and functions will be conditioned on one of: #if !defined(__cplusplus) || defined(__STDC_INTTYPES_LIMITS) #if !defined(__cplusplus) || defined(__STDC_INTTYPES_PRINT_SCAN) Because final wording was not available during the meeting, a further paper will be circulated for comment and merged in as part of the final editorial review. During discussion of the paper it was agreed to add the following to 6.8.8 (predefined macros): The implementation shall not define the macro __cplusplus. and to change the wording of 6.1.4 (string literal) to allow narrow and wide string literals to be concatenated (producing a wide string literal; this eliminates the need for wide equivalents of the PRI* and SCN* macros in ). N789 addresses major ambiguities in the wording describing signal handlers. If a signal is caused by the raise() or abort() functions, it may do anything except call raise(). If it is caused by any other (asynchronous) event, it may only return (if it was not a computational error such as SIGFPE, SIGILL, or SIGSEGV) or call either abort() or _exit() (in particular, it may not call longjmp()). The _exit() function is new to C, and the intent is that it behaves like the POSIX function of the same name. However, because of concerns over compatibility, this part has been passed to a special review committee who have the power to alter the definition of _exit() or remove it entirely. Note that, without this, there is no way for a signal like SIGFPE to terminate the program normally. N790 replaces N732, which was an attempt to address the issues surrounding the term "implementation-defined" and the question of how much freedom the implementer has. It was agreed that both unspecified and implementation-defined behaviour must simply be a choice among correct behaviours and cannot cause the program to terminate or "go wrong". N732 defined a new conformance term to handle the cases where that was deemed insufficient, but this approach was rejected. Instead, N790 addressess 7 particular places where wording needs addressing, and also provides clearer wording for the terms "unspecified" and "implementation-defined". These words, and the wording changes in items 3, 6, 7, and 8 were adopted. The changes in items 4 and 5 were deemed unnecessary, and item 2 is still outstanding. N791 resolves the thorny issue of the "struct hack" by allowing a new form of structure definition: struct hack { size_t n; int x []; }; which can be used to implement the technique portably; the member x takes up no space but can be used to address any sized array that will fit in an object being overlaid on to the structure. N792 is a rewrite of N758, and adds an informative annex documenting how C9X relates to ISO 10967-1 (Language Independent Arithmetic). N793 replaces item H of N764. It provides new functions that take account of time zones, Daylight Saving Time, and leap seconds in a portable manner, and also clarifies the specification of the existing functions. The new functions are mkxtime(), zonetime(), and strxftime(), and all three use a new type "struct tmx" which is an extensible form of the "struct tm" type. One important clarification is that all the functions work entirely in the Gregorian calendar. Other changes made ================== A few other significant changes, as well as several editorial ones, were made to the Standard after defects in the existing words were noted. In general these do not relate to specific papers. The change recommended in the response to DR156 has been made, clarifying that file positions (both those from ftell() and the fpos_t type) relate to a file, not a stream. Footnotes referred to more than once will only appear once in the document. Examples of hexadecimal floating constants have been added. The statement: If the } that terminates a function is reached, and the value of the function call is used by the caller, the behavior is undefined. has moved from 6.6.6.4 (return statement) to 6.7.1 (function definitions). The wording to do with "dangling else clauses" has been changed to avoid a pathological case: if (c1) // correct if statement do if (c2) // nearest if statement in the same block s2; while (c3); else s2; // where does this connect to ? The setvbuf() function is allowed to take notice of the buffer size argument even if a null pointer is passed for the buffer. The second paragraph of 5.2.3 (signals) moved to 7.1.8 (use of standard library functions). It was agreed that scanf() should fail on the conversion "%10c" if less than 10 characters remain in the input stream, but there was no wording change. Outstanding issues ================== The following items were intended to be considered at the meeting, but were left unaddressed due to lack of time. It is hoped that they will be addressed through National Body comments on the Committee Draft. N783 items 1, 2, 11, 12, 14, 15, and 16. N790 item 2. Failed papers ============= The following papers did not achieve consensus, and so have not been adopted. N708 addressed the issue of object sizes and pointer differences that are outside the range of size_t and ptrdiff_t respectively. There was insufficient interest in solving this problem. N747 suggested various changes to do with IEC 559 signalling NaNs. There was no interest expressed in it. N784 suggested new wording to increase the implementer's flexibility in dealing with indirect calls to inlined functions. There was no consensus on the paper (1 country approved and 1 disapproved, with 1 abstaining). Basic hardware I/O ================== There have been a number of papers on the topic of basic hardware I/O functionality and the header, the latest of which is N771. This topic has been variously accepted and rejected by WG14, and is regularly re-introduced by Denmark. There was a presentation at the meeting by the Danish representative and another by representatives of the Uniform Driver Interface group. After vigorous discussion on the technical merits of each approach, as well as whether or not this functionality belonged in C as opposed to some other standard, it was resolved: that WG14 take the position that an I/O annex is inappropriate at this time, and that a group be formed to produce a technical report that can be used as input to possible future revision of the Standard. [UK and US approved (J11 vote 10 for, 1 against), Denmark disapproved]. A separate private mailing list is to be set up for further discussion on the topic. Public review process ===================== A document can be sent to SC22 as the Committee Draft whenever the Convenor is satisfied with it; a separate vote within WG14 is not needed. The next major draft, including all approved changes, will be circulated to committee members on 4th November 1997. There will be an editorial review meeting in Santa Cruz, California, on 17th-19th November 1997, with the intention of producing the actual Committee Draft based on such comments. On this basis the Committee Draft will be sent to SC22 on 26th November 1997, and will reach National Bodies within 2 weeks. In addition, it will be made widely available electronically to allow the general public to review and comment on it. National Bodies must make their own individual arrangements for the receipt and processing of public comments; National comments must be sent to SC22 within 3 months of the official publication date (and thus by 26th February 1998). Other matters ============= The next meeting will be in Boulder, Colorado, on 2nd-6th February 1998. An invitation has been received from Intel to host the first 1999 meeting in the Portland, Oregon area, on 1st-5th February 1999; details will be in the next mailing. All J11 document mailings except the next one, and all WG14 document mailings including the next one, will be done electronically only.