Page 195 - C-Language
P. 195

Chapter 28: Implementation-defined


        behaviour




        Remarks



        Overview



        The C standard describes the language syntax, the functions provided by the standard library, and
        the behavior of conforming C processors (roughly speaking, compilers) and conforming C
        programs. With respect to behavior, the standard for the most part specifies particular behaviors
        for programs and processors. On the other hand, some operations have explicit or implicit
        undefined behavior -- such operations are always to be avoided, as you cannot rely on anything
        about them. In between, there are a variety of implementation defined behaviors. These behaviors
        may vary between C processors, runtimes, and standard libraries (collectively, implementations),
        but they are consistent and reliable for any given implementation, and conforming implementations
        document their behavior in each of these areas.

        It is sometimes reasonable for a program to rely on implementation-defined behavior. For
        example, if the program is anyway specific to a particular operating environment then relying on
        implementation-defined behaviors general to the common processors for that environment is
        unlikely to be a problem. Alternatively, one can use conditional compilation directives to select
        implementation-defined behaviors appropriate for the implementation in use. In any case, it is
        essential to know which operations have implementation defined behavior, so as to either avoid
        them or to make an informed decision about whether and how to use them.


        The balance of these remarks constitute a list of all the implementation-defined behaviors and
        characteristics specified in the C2011 standard, with references to the standard. Many of them use
        the terminology of the standard. Some others rely more generally on the context of the standard,
        such as the eight stages of translating source code into a program, or the difference between
        hosted and freestanding implementations. Some that may be particularly surprising or notable are
        presented in bold typeface. Not all the behaviors described are supported by earlier C standards,
        but generally speaking, they have implementation-defined behavior in all versions of the standard
        that support them.


        Programs and Processors


        General


            •  The number of bits in one byte (3.6/3). At least 8, the actual value can be queried with the
              macro CHAR_BIT.


            •  Which output messages are considered "diagnostic messages" (3.10/1)






        https://riptutorial.com/                                                                             171
   190   191   192   193   194   195   196   197   198   199   200