🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.sys.ibm.pc.rt
2 messages
2 total messages Started by olovsson Tomas Olovsson Tue, 21 Nov 1989 10:07
Problem with hc
#584
Author: olovsson Tomas Olovsson
Date: Tue, 21 Nov 1989 10:07
29 lines
1131 bytes
Hello everyone!

I have problems with hc accepting constructions like:

    main()
    {
	int i;

	(int)i = 0;
    }

% hc c.c
E "c.c",L5/C12:	(syntactic)  unexpected symbol:'='
REPAIR:   ';' replaces '='@"c.c",L5/C12
1 user error   No warnings   


All other C-compilers seem to accept this construction. For hc the line has to
be changed to:

    ((int) i) = 0;


Is this correct (or intentional)?

-----------------------------------------------------------------------------
     Tomas Olovsson
     olovsson@ce.chalmers.se
Re: Problem with hc
#591
Author: Ken Raeburn
Date: Sun, 26 Nov 1989 04:09
24 lines
1151 bytes
In article <1732@mathrt0.math.chalmers.se> olovsson@ce.chalmers.se writes:
>I have problems with hc accepting constructions like:
>    main()
>    {
>	int i;
>	(int)i = 0;
>    }
...
>All other C-compilers seem to accept this construction. For hc the line has to
>be changed to:
>
>    ((int) i) = 0;
>
>Is this correct (or intentional)?

I would hope that the former "problem" is intentional; it is correct.

The latter construct is essentially the same as the first.  It is also
incorrect, and the compiler should have complained.

Casts do not produce lvalues; you cannot assign to their results.
(See the proposed ANSI C standard, section 3.3.4, Cast Operators.)

-- Ken
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