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

Username
  

Password
  





  Rule 2.5 Does #undef count as a "use"
Posted by: misra-c - 09-10-2014, 08:31 AM - Forum: 8.2 Unused code - Replies (3)

Rule 2.5 Is #undef considered a “use” of a macro”?
For example

Code:
#define M1 This
   #define M2 That
   #undef M1
   use( M2 );
Is 'M1' unused and therefore violate rule 2.5, or does the #undef count as a use of M1?

Print this item

  Is a function parameter “used” if cast to void?
Posted by: misra-c - 09-10-2014, 08:29 AM - Forum: 8.2 Unused code - Replies (1)

Does the following violate rule 2.7 (There should be no unused parameters in functions)?

Code:
void fn ( int32_t param )
{
   ( void )param;
}

Print this item

  A question for Rule8.3
Posted by: nyoshi - 02-10-2014, 05:31 PM - Forum: 8.8 Declarations and defnitions - Replies (1)

I have a question for an exception of Rule8.3.

I think that the structure "tab" of the following sample does not have compatibility.
Is this right?

Code:
[test1.c]
struct tab {
   signed char a;
   signed short  b;
};

struct  tab a;

[test2.c]
Code:
struct tab {
   signed char a;
   signed short int  b;
};

extern struct tab a; /* non-compliant - incompatible version */

Best Regards,
nyoshi

Print this item

  9.References on MISRA-C:2012
Posted by: ogawa.kiyoshi - 23-09-2014, 08:34 AM - Forum: General Questions - Replies (1)

I am checking the 9.References on MISRA-C:2012.

[1] MISRA Guidelines for the Use of the C Language In Vehicle Based Software ISBN 0-9524159-9-0, Motor Industry Research
Association, Nuneaton, April 1998.
This is ISBN 10.

It was also in the reference on MISRA-C 2004.

but

On a paper book of Guidelines for the Use of the C Language in Vehicle Based Software
ISBN 0-9524156-9-0
This is ISBN 10.

Please check them.

In Japanese Guide to guideline for MISRA-C:2004,
the reference of the document was ISBN 0-9524156-9-0.
We might report it already.

BTW.,
In misra web site http://www.misra.org.uk/Publications/tab...fault.aspx
Guidelines for the Use of the C Language in Vehicle Based Software, ISBN 978-0-9524156-6-5, April 1998.
This is ISBN 13.

Best Regards.
Dr. Kiyoshi Ogawa
@kaizen_nagoya

Print this item

  Rule 8.8
Posted by: Akhil - 04-09-2014, 12:14 PM - Forum: 8.8 Declarations and defnitions - Replies (1)

1. extern int s=10;
2. static int s;
3.
4. void foo()
5. {
6. /* Do Something*/
7. }


Is line 1 non compliant for Rule 8.8 in the above example. I'm confused since line 1 gives a definition and not just declaration.
Here I'm not able to make out whether the var 's' have external or internal linkage.

My compiler binds 's' var with extern linkage if a definition is given with extern.(is value is also assigned like the above case).

Print this item

  Meaning of MISRA AC SLSF 045B (par. 3.6.11)
Posted by: neffnan - 29-08-2014, 03:08 PM - Forum: MISRA AC SLSF discussions - Replies (1)

I can't make sense of the wording of 045B. I think there may be a copy-&-paste problem--the English seems garbled--but I'm not sure enough of my understanding of Stateflow yet to figure out what the 'correct' and 'incorrect' examples are meant to convey, so I'm not comfortable assuming how the rule should read. Could someone perhaps explain this rule for me or tell me how the rule should read? Thanks.

Print this item

  7-3-1 declarations and definitions
Posted by: gs - 25-08-2014, 04:33 PM - Forum: 6.7 Declarations (C++) - Replies (1)

Does rule 7-3-1 require a function declared at global scope be declared as "extern 'C'" for both the function's declaration and its definition or does one "extern 'C'" for that function suffice? For example, is this okay:

Code:
extern "C" void f();
void f() {}

Print this item

  Abandoned?
Posted by: gs - 25-08-2014, 04:31 PM - Forum: C++ General - Replies (3)

Given the general lack of response with respect to MISRA C++ guidelines, is it fair to say MISRA C++ has been effectively "abandoned" by the committee?

Print this item

  Rule 8–4–4 (Required) function identifier with & or ()
Posted by: Achim Olaf Zacher - 13-08-2014, 07:38 PM - Forum: 6.8 Declarators (C++) - Replies (5)

Is it intended to ban the use of
[code]std::cout

Print this item

  Rule 15.5
Posted by: Mandar_Pitale - 13-08-2014, 10:13 AM - Forum: 8.15 Control flow - Replies (3)

Rule 15.5 is "A function should have a single point of exit at the end".

The Rationale of this rule says:

Early returns may lead to the unintentional omission of function termination code.

1. What is "function termination code" in this context? Does it mean user defined C statements of the function or the function epilogue after the compilation?

2. If it is the function epilogue, then does it mean that when multiple exit points are used, then it MAY result in imbalanced context retrieval when the function returns, for some compilers?

Print this item

Search Forums

(Advanced Search)

Forum Statistics
» Members: 6,204
» Latest member: domarant
» Forum threads: 1,017
» Forum posts: 2,796

Full Statistics

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

Latest Threads
Rule 7.0.5, example non-c...
Forum: 4.7 Standard conversions
Last Post: cgpzs
17-04-2025, 12:10 PM
» Replies: 0
» Views: 171
A3-3-2 Contradictory exam...
Forum: AUTOSAR C++:2014 rules
Last Post: cgpzs
31-03-2025, 09:30 AM
» Replies: 2
» Views: 299
16.6.1 clarification
Forum: 4.16 Overloading
Last Post: cgpzs
31-03-2025, 09:29 AM
» Replies: 2
» Views: 285
Rule 9.3.1 - iteration st...
Forum: 4.9 Statements
Last Post: misra cpp
28-03-2025, 01:17 PM
» Replies: 1
» Views: 192
Rule 8.2.8 - why aren't a...
Forum: 4.8 Expressions
Last Post: misra cpp
28-03-2025, 01:05 PM
» Replies: 1
» Views: 209
Typo in Appendix C of MIS...
Forum: 8.10 The essential type model
Last Post: Yordan Naydenov
17-03-2025, 02:58 PM
» Replies: 0
» Views: 165
Adopted modal expressions...
Forum: General Questions
Last Post: Yordan Naydenov
17-03-2025, 09:01 AM
» Replies: 0
» Views: 263
Roadmap to c23 support
Forum: General Questions
Last Post: ACHart
28-02-2025, 03:23 PM
» Replies: 0
» Views: 212
Rule 6.2.1 weak linkage
Forum: 4.6 Basic concepts
Last Post: misra cpp
28-02-2025, 01:04 PM
» Replies: 1
» Views: 268
A8-4-5: Should have an ex...
Forum: AUTOSAR C++:2014 rules
Last Post: misra cpp
21-02-2025, 12:58 PM
» Replies: 3
» Views: 701