Re: shame on MISRA
- From: Marcin Wolcendorf <wolcendo@xxxxxxxxxxxxxx>
- Date: Mon, 23 Apr 2007 09:46:24 +0000 (UTC)
Marcin Wolcendorf <wolcendo@xxxxxxxxxxxxxx> wrote:
On Sun, 22 Apr 2007 08:58:18 -0700, Arlet wrote:
On Apr 22, 12:44 pm, Marcin Wolcendorf <wolce...@xxxxxxxxxxxxxx>...
wrote:
No. It doesn't. One of the rules states (I don't have them in front
of me), that you can't use signed constants (like -1U) to set
unsigned variables. -1U is a nice value of all 1s binary,
convenient for masking. Well, you can get
Just use ~0U
True :).
I can't recall the reason, why I didn't use it.
Yeah, now I can. It just doesn't matter. If I use ~0U it will trigger
MISRA-C rule 10.1 (An integer constant expression with negative value is
being converted to an unsigned type.) just as -1U does. No difference
from MISRA-C check point of view. It is a better way- logical operators
only, and this is a logical value- but it is not enough.
M.
.
- Follow-Ups:
- Re: shame on MISRA
- From: Boudewijn Dijkstra
- Re: shame on MISRA
- From: Robert Adsett
- Re: shame on MISRA
- References:
- Re: shame on MISRA
- From: Marcin Wolcendorf
- Re: shame on MISRA
- From: Arlet
- Re: shame on MISRA
- From: Marcin Wolcendorf
- Re: shame on MISRA
- Prev by Date: I wants to know about the interfacing lcd to 8051 microcontroller
- Next by Date: Re: 24C02 and 24C64
- Previous by thread: Re: shame on MISRA
- Next by thread: Re: shame on MISRA
- Index(es):