Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





  Rule 2.1 has an Exception.
Posted by: ogawa.kiyoshi - 13-01-2014, 12:20 PM - Forum: 8.2 Unused code - Replies (1)

In rule 2.1, Note: "code that has been conditionally excluded by pre-processor directives is not subject to this rule as it is not presented to the later phases of translation.". I think this statement may be "Exception". Do you think so?

Print this item

  Rule 8.4 - How are tentative definitions handled
Posted by: misra-c - 19-12-2013, 08:25 AM - Forum: 8.8 Declarations and defnitions - Replies (5)

Which of the following are compliant with rule 8.4?

Code:
extern int32_t  ext_val0 = 3;

       int32_t  ext_val1 = 3

extern int32_t  extval2;              
       int32_t  extval2 = 3;

       int32_t  ext_val3;                
       int32_t  ext_val3 = 3;

       int32_t  ext_val4;

Print this item

  Dir 4.6 Does "plain char" need to be typedeffed
Posted by: misra-c - 18-12-2013, 02:48 PM - Forum: 7.4 Code design - Replies (1)

Does Directive 4.6 cover the use of the plain “char” type for the storage and handling of character values?
For example

Code:
const char * string = “some data”;  /* compliant or not ? */

Print this item

  Definition of "constant expression"
Posted by: gs - 16-12-2013, 05:15 PM - Forum: 8.12 Expressions - Replies (7)

For rule 12.4, what definition of "constant expression" is used? If the definition is the one from the ISO C standards, that definition does not make it clear the example

Code:
const uint16_t c = 0xffffu;
uint16_t y = c + 1u;
is compliant because a constant variable, if initialized with a constant expression "can be evaluated during translation rather than runtime".

For the record, different compilers appear to take different approaches as to whether or not a const-qualified variable meets the definition of a "constant expression".

Print this item

  Clarification of Rationale for Rule 10.8
Posted by: ogawa.kiyoshi - 12-12-2013, 07:13 AM - Forum: 8.10 The essential type model - Replies (1)

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?

Print this item

  Rule 15.3, switch's, and "fallthru"
Posted by: gs - 10-12-2013, 04:59 PM - Forum: 8.15 Control flow - Replies (1)

Rule 15.3 states, "For the purposes of this rule, a switch-clause that does not consist of a compound statement is treated as if it were a block." What if the switch-clause did not end in an unconditional "break;"? While I understand such code would violate other rule(s), the point raised remains: would the following code violate this rule?

Code:
...
switch( a )
{
case 1:
    if( f(a) > 8 )
        goto b;
    doingSomething();
case 2:
    doingSomeOtherThing();
b:
    tada( a );
    break;
default:
    break;
}
...

Print this item

  Dir4.1 Undefined.
Posted by: ogawa.kiyoshi - 30-11-2013, 11:24 AM - Forum: 7.4 Code design - Replies (1)

Dea all. I am a member of MISRA-C Study Group Japan.

There are two question/information.

1.
At Dir4.1 , Undefined C90 and C99 are listed.
I think C99 Undefined 15 is related C90 Undefined 90.
Are there any relation between Dir4.1 and C90 Undefined 90.

2.
The table of Appendix H.1, some differences from Dir4.1 Undefiend C90 and C99 list.
At Appendix H.1
C99 42 and 112 has "Dir4.1" , perhaps, C99 43 and 113.
C99 44, 45,48, 49, and C90 94 have no "Dir4.1".

Best Regards.
[email protected]

Print this item

  MISRA Exemplar Suite
Posted by: MarkTootell - 29-11-2013, 11:18 AM - Forum: General Questions - Replies (3)

Hi

As with the exemplar suite for C:2004 is there, or will there be, an exemplar suite for C++:2008 and C:2012? I am wanting to access the abilities of some of my companies compilers and also third party static analysis tools and would find these very useful.

Thanks

Print this item

  Will Exemplar Suite be updated for 2012?
Posted by: SteveTj - 25-11-2013, 10:27 PM - Forum: MISRA-C:2004 Exemplar Suite - Replies (2)

Will the MISRA-C:2004 Exemplar Suite be updated for MISRA-C:2012?

Thanks!

SteveTj

Print this item

  0-1-8. Exception: empty interface function.
Posted by: Alex-R - 18-11-2013, 01:55 PM - Forum: 6.0 Language independent issues (C++) - Replies (4)

0-1-8:
The following are examples of external side effects:
• Reading or writing to a ile, stream, etc.;
• Changing the value of a non local variable;
• Changing the value of an argument having reference type;
• Using a volatile object;
• Raising an exception.


Situation:
There is some mouse interface: OnMouseUp, OnMouseDone, OnMouseMove... or some other manipulator interface... does not matter...
There are some objects that use this interface but not all objects need all functions, so it is possible:
void SomeObject::OnMouseMove ( uint32 x, uint32 y)
{
//do nothing
}

Print this item

Search Forums

(Advanced Search)

Forum Statistics
» Members: 6,309
» Latest member: 1fuhd
» Forum threads: 1,066
» Forum posts: 2,933

Full Statistics

Online Users
There are currently 96 online users.
» 0 Member(s) | 93 Guest(s)
Bing, Google, UptimeRobot

Latest Threads
13.2 Was TC2 correctly ap...
Forum: 8.13 Side effects
Last Post: misra-c
08-10-2026, 12:47 PM
» Replies: 1
» Views: 625
20.12 Does the stringific...
Forum: 8.20 Preprocessing directives
Last Post: misra-c
08-10-2026, 12:40 PM
» Replies: 1
» Views: 554
13.3 Should side effects ...
Forum: 8.13 Side effects
Last Post: misra-c
08-10-2026, 12:37 PM
» Replies: 1
» Views: 428
11.6 pointer to pointer t...
Forum: 8.11 Pointer type conversions
Last Post: misra-c
08-10-2026, 12:21 PM
» Replies: 2
» Views: 1,032
What is the UTLR of -1?
Forum: 8.10 The essential type model
Last Post: misra-c
08-10-2026, 12:15 PM
» Replies: 1
» Views: 597
10.3 Clarify if narrower ...
Forum: 8.10 The essential type model
Last Post: misra-c
08-10-2026, 11:57 AM
» Replies: 1
» Views: 508
It 8.12 intended to be so...
Forum: 8.8 Declarations and defnitions
Last Post: misra-c
08-10-2026, 11:50 AM
» Replies: 1
» Views: 455
Rule 0.1.1 Example f4
Forum: 4.0 Language independent issues
Last Post: cgpzs
07-10-2026, 11:07 AM
» Replies: 3
» Views: 727
Rule 6-2-2 Usage of std::...
Forum: 6.6 Statements (C++)
Last Post: misra cpp
25-09-2026, 05:43 PM
» Replies: 1
» Views: 437
M5-0-4 switch over unscop...
Forum: 6.5 Expressions (C++)
Last Post: misra cpp
25-09-2026, 01:00 PM
» Replies: 3
» Views: 539