Article View: comp.sys.ibm.pc.rt
Article #591Re: Problem with hc
From: Ken Raeburn
Date: Sun, 26 Nov 1989 04:09
Date: Sun, 26 Nov 1989 04:09
24 lines
1151 bytes
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
Technical Details
Message-ID:
<1989Nov26.040925.16696@athena.mit.edu>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!snorkelwacker!bloom-beacon!raeburnReferences:
<1732@mathrt0.math.chalmers.se>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!snorkelwacker!bloom-beacon!raeburn From: raeburn@athena.mit.edu (Ken Raeburn) Newsgroups: comp.sys.ibm.pc.rt Subject: Re: Problem with hc Message-ID: <1989Nov26.040925.16696@athena.mit.edu> Date: 26 Nov 89 04:09:25 GMT References: <1732@mathrt0.math.chalmers.se> Sender: news@athena.mit.edu (News system) Reply-To: raeburn@athena.mit.edu (Ken Raeburn) Organization: Massachusetts Institute of Technology Lines: 24