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

Username
  

Password
  





  Rule 10-3-1
Posted by: wcarl - 17-01-2014, 04:48 PM - Forum: 6.10 Derived classes (C++) - Replies (3)

There shall be no more than one definition of each virtual function on each path through the inheritance hierarchy.

If I'm interpreting this rule correctly, once you define a virtual function for a derived class with the virtual base class as an ancestor, no more derivations in the chain can override the first definition.

This would seem to cripple a key advantage of using classes and an object-oriented design.

Isn't it pretty common to override a virtual member function in a child class even if the parent class has provided a different definition? Please explain.

Print this item

  Rule 6.1
Posted by: Akhil - 15-01-2014, 06:48 AM - Forum: 8.6 Types - Replies (1)

In the Amplification for Rule 6.1 :

For C99 : The appropriate types are :

1. either unsigned or signed int.
This refers to unsigned int and signed int only OR any other datatype..?

2. Another explicitly signed or explicitly unsigned integer type that is premitted by the implementation.
What all types does this refer to ? Does this refer to unsigned short OR unsigned short int etc.

Please clarify.

Print this item

  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 (3)

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

Search Forums

(Advanced Search)

Forum Statistics
» Members: 6,171
» Latest member: stephanmuench
» Forum threads: 998
» Forum posts: 2,752

Full Statistics

Online Users
There are currently 323 online users.
» 0 Member(s) | 320 Guest(s)
Applebot, Bing, Google

Latest Threads
Rule 6.2.1: non-inline co...
Forum: 4.6 Basic concepts
Last Post: cgpzs
22-11-2024, 10:11 AM
» Replies: 0
» Views: 26
Rule 0.1.2
Forum: 4.0 Language independent issues
Last Post: stephanmuench
21-11-2024, 01:12 PM
» Replies: 0
» Views: 36
A18-9-4
Forum: AUTOSAR C++:2014 rules
Last Post: cgpzs
23-10-2024, 12:04 PM
» Replies: 2
» Views: 380
A8-4-5: are partial moves...
Forum: AUTOSAR C++:2014 rules
Last Post: misra cpp
22-10-2024, 02:03 PM
» Replies: 1
» Views: 328
model information blocks ...
Forum: MISRA AC SLSF discussions
Last Post: misra-ac
22-10-2024, 01:27 PM
» Replies: 1
» Views: 4,446
MISRA AL SLSF - Rule 043I
Forum: MISRA AC SLSF discussions
Last Post: misra-ac
22-10-2024, 01:11 PM
» Replies: 1
» Views: 8,863
MISRA AC EC guidelines
Forum: MISRA AC SLSF discussions
Last Post: misra-ac
21-10-2024, 08:21 AM
» Replies: 4
» Views: 15,506
News on future releases
Forum: MISRA AC SLSF discussions
Last Post: misra-ac
21-10-2024, 08:05 AM
» Replies: 1
» Views: 5,694
Signal naming convention ...
Forum: MISRA AC SLSF discussions
Last Post: misra-ac
21-10-2024, 07:57 AM
» Replies: 1
» Views: 7,248
Rule 7.0.2: operator cons...
Forum: 4.7 Standard conversions
Last Post: karos
14-10-2024, 08:52 PM
» Replies: 2
» Views: 437