Clarification of Rationale for Rule 10.8

Moderators: misra-c, david ward

Post Reply
ogawa.kiyoshi
Posts: 15
Joined: Fri May 27, 2005 10:08 am
Company: NMIRI, Gifu-University, TOPPERS project
Location: Japan

Clarification of Rationale for Rule 10.8

Post by ogawa.kiyoshi » Thu Dec 12, 2013 7:13 am

Rule 10.8 Rationale 3rd paragraph,

"On a 16-bit machine the addition will be performed in 16 bits with the
result wrapping modulo-2 before it is cast to 32 bits."

It will be understood that.

"On a 16-bit machine the addition will be performed in 16 bits with the
result wrapping like modulo-2 before it is cast to 32 bits."

or

"On a 16-bit machine the addition will be performed in 16 bits with the
result wrapping modulo-2^16 before it is cast to 32 bits."

Which do you prefere?
Dr. OGAWA Kioshi
@kaizen_nagoya

misra-c
Posts: 566
Joined: Thu Jan 05, 2006 1:11 pm

Re: Clarification of Rationale for Rule 10.8

Post by misra-c » Fri Dec 13, 2013 9:00 am

We agree that the following wording would be clearer.

“ On a 16-bit machine the addition will be performed in 16 bits with the result wrapping modulo-2^16 before it is cast to 32 bits.”

where "^" means "raise to the power of"
---
Posted by and on behalf of
the MISRA C Working Group

Post Reply

Return to “8.10 The essential type model”