🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Jim Russell Wed, 12 Aug 1992 04:31
Extraneous warning w/ -ansi -pedantic
#929
Author: Jim Russell
Date: Wed, 12 Aug 1992 04:31
25 lines
1075 bytes
The following program:
    struct goo {
      int i;
    } a, b;

    main()
    {
      int x, y;

      y = ( x ? a : b ).i;
    }

when compiled with "gcc -ansi -pedantic" gets the following warning:
    goo.c: In function `main':
    goo.c:9: warning: ANSI C forbids use of conditional expressions as lvalues

However, ANSI does not requre that the first operand of the . operator be
an lvalue.  In fact, they even give an example (sec 3.3.2.3, pg 43 line 14)
where the first operand is not an lvalue (it's a function return in their
example).

We got this warning with gcc version 2.2 on the RS/6000, and gcc version
2.2.2 on the Sparc.

- Jim
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads