DDK's C compiler ought to conform a bit better
- From: "Norman Diamond" <ndiamond@xxxxxxxxxxxxxxxx>
- Date: Mon, 11 Jul 2005 19:06:21 +0900
C standard page 81 footnote 85:
A cast does not yield an lvalue.Of course I would prefer if the standard would state that rule normatively instead of advisorily, but the committee's intention is clear.
Page 91 section 6.5.16 applies to all kinds of assignment operators:
Constraints An assignment operator shall have a modifiable lvalue as its left operand.
Conforming C implementations are required to issue at least one diagnostic when given a translation unit containing the following:
ULONG x = 8; // OK
(ULONG)x |= 3; // violation of a constraint
OK, sure the DDK's C compiler isn't a real C compiler. But why ignore something like this? For example suppose the declaration of x were actually a ULONG_PTR and just happened by accident to map onto a ULONG, while the cast is still a ULONG? As a matter of fact that's exactly the situation where I saw it. Why not issue a warning?
.
- Follow-Ups:
- Re: DDK's C compiler ought to conform a bit better
- From: Calvin Guan
- Re: DDK's C compiler ought to conform a bit better
- Prev by Date: Re: Can USB driver capture sound of PC?
- Next by Date: Re: Questions about MSDN for some DDK functions
- Previous by thread: Can we edit unidrv.dll for printer driver?
- Next by thread: Re: DDK's C compiler ought to conform a bit better
- Index(es):