Re: shame on MISRA
- From: Marcin Wolcendorf <wolcendo@xxxxxxxxxxxxxx>
- Date: Mon, 23 Apr 2007 16:30:16 +0000 (UTC)
Hi,
On Mon, 23 Apr 2007 06:47:55 -0700, Robert Adsett wrote:
On Apr 23, 5:46 am, Marcin Wolcendorf <wolce...@xxxxxxxxxxxxxx> wrote:
Marcin Wolcendorf <wolce...@xxxxxxxxxxxxxx> wrote:
On Sun, 22 Apr 2007 08:58:18 -0700, Arlet wrote:
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
Maybe I'm being exceptionally dense this morning but What integer
constant expression with a negative value?
Well, having ~0U is not quite enough; I want to use it :). So I did:
uint16_t some_variable = (uint16_t)(~0U);
(effectively- all #defines, ...) to have 0xffff in some_variable. It was
enough to trigger the rule.
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.
Is this an automated check against the rules or a hand check?
It is an automated check. I'm not sure enough that my mind won't bend the
rule, to do a hand check, sorry ;).
M.
.
- Follow-Ups:
- Re: shame on MISRA
- From: Robert Adsett
- Re: shame on MISRA
- From: Robert Adsett
- Re: shame on MISRA
- From: CBFalconer
- 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
- From: Marcin Wolcendorf
- Re: shame on MISRA
- From: Robert Adsett
- Re: shame on MISRA
- Prev by Date: Re: CANbus consultant?
- Next by Date: Re: shame on MISRA
- Previous by thread: Re: shame on MISRA
- Next by thread: Re: shame on MISRA
- Index(es):