Subj : Re: Non-strictly-conforming and unspecified versus undefined behavior To : comp.programming.threads,comp.std.c From : Wojtek Lerch Date : Fri Feb 18 2005 03:11 pm "David Schwartz" wrote in message news:cv5g3v$lmn$1@nntp.webmaster.com... > The standard does not say that output cannot depend upon > implementation-defined behavior. If it did, then no useful POSIX strictly > conforming program could be written. It depends on whether you mean "strictly conforming program" as defined by the C standard, or "Strictly Conforming POSIX Application" as defined by POSIX. A Strictly Conforming POSIX Application must #define _POSIX_C_SOURCE; a strictly conforming C program must not. A Strictly Conforming POSIX Application is an application that requires only the facilities described in IEEE Std 1003.1-2001. Such an application: 1. Shall accept any implementation behavior that results from actions it takes in areas described in IEEE Std 1003.1-2001 as implementation-defined or unspecified, or where IEEE Std 1003.1-2001 indicates that implementations may vary 2. Shall not perform any actions that are described as producing undefined results 3. For symbolic constants, shall accept any value in the range permitted by IEEE Std 1003.1-2001, but shall not rely on any value in the range being greater than the minimums listed or being less than the maximums listed in IEEE Std 1003.1-2001 4. Shall not use facilities designated as obsolescent 5. Is required to tolerate and permitted to adapt to the presence or absence of optional facilities whose availability is indicated by POSIX Conformance 6. For the C programming language, shall not produce any output dependent on any behavior described in the ISO/IEC 9899:1999 standard as unspecified, undefined, or implementation-defined, unless the System Interfaces volume of IEEE Std 1003.1-2001 specifies the behavior 7. For the C programming language, shall not exceed any minimum implementation limit defined in the ISO/IEC 9899:1999 standard, unless the System Interfaces volume of IEEE Std 1003.1-2001 specifies a higher minimum implementation limit 8. For the C programming language, shall define _POSIX_C_SOURCE to be 200112L before any header is included Within IEEE Std 1003.1-2001, any restrictions placed upon a Conforming POSIX Application shall restrict a Strictly Conforming POSIX Application. .