Blame test-c/unspcs.c

Packit Service 8bf002
/*
Packit Service 8bf002
 *  unspcs.c:
Packit Service 8bf002
 * 1998/08      made public                                     kmatsui
Packit Service 8bf002
 *
Packit Service 8bf002
 *   These texts are unportable ones, because the order of the evaluation is
Packit Service 8bf002
 * unspecified.  Good preprocessor will warn at these texts even if the
Packit Service 8bf002
 * results are valid.  Good preprocessor will also document the order of
Packit Service 8bf002
 * evaluation and the behavior on invalid results.
Packit Service 8bf002
 *   Note: Order of evaluation of sub-expressions (other than operands of &&,
Packit Service 8bf002
 * ||, ? :) of #if expression is also unspecified.  The order, however, never
Packit Service 8bf002
 * affects the result, because #if expression never cause side effect, so no
Packit Service 8bf002
 * warning is necessary.  Precedence and grouping rules of operators are other
Packit Service 8bf002
 * things than order of evaluation, and shall be obeyed by preprocessor.
Packit Service 8bf002
 */
Packit Service 8bf002
Packit Service 8bf002
#include    "defs.h"
Packit Service 8bf002
Packit Service 8bf002
#define str( a)     # a
Packit Service 8bf002
#define xstr( a)    str( a)
Packit Service 8bf002
Packit Service 8bf002
main( void)
Packit Service 8bf002
{
Packit Service 8bf002
/* s.1.1:   Order of evaluation of #, ## operators. */
Packit Service 8bf002
#define MAKWIDESTR( s)  L ## # s
Packit Service 8bf002
/*  Either of L"name"; or L# name; ("L#" is not a valid pp-token).  */
Packit Service 8bf002
    assert( MAKWIDESTR( name)[ 0] == L'n');
Packit Service 8bf002
Packit Service 8bf002
/* s.1.2:   Order of evaluation of ## operators.    */
Packit Service 8bf002
#define glue3( a, b, c)     a ## b ## c
Packit Service 8bf002
/*  "1.a" or undefined, since .a is not a valid pp-token, while 1. and 1.a are
Packit Service 8bf002
        valid pp-tokens.    */
Packit Service 8bf002
    puts( xstr( glue3( 1, ., a)));
Packit Service 8bf002
Packit Service 8bf002
    return  0;
Packit Service 8bf002
}
Packit Service 8bf002