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

Username
  

Password
  





  HIS Subset of MISRA
Posted by: [email protected] - 27-07-2018, 07:17 PM - Forum: General Questions - Replies (4)

Dear colleagues,
I am trying to find in the web the MISRA subset for HIS with no success.
Does anybody know where it is possible to get these files / list of rules?

Thanks in advance,

Ricardo

Print this item

  Rule 3-4-1 and defining constants in one place
Posted by: rrosier - 26-07-2018, 12:28 PM - Forum: 6.3 Basic concepts (C++) - Replies (3)

If one were to use the strategy of defining all the constants used within a file at the top of the file, either as static const or in an unnamed namespace, but some of the constants are used in multiple places and others are only used in single places, then those that are only used in single places will violate Rule 3-4-1.

If those that are used only in single places are subsequently moved into blocks with reduced scope, then the constants are scattered around the file.

This could create a maintenance headache because it is more difficult for a developer to find a constant.

Furthermore, if a developer needs to use a singly-used constant now in another place, they might not realise that the constant has already been defined (and then widen its scope) but instead add in a new singly-used constant of reduced scope in the new place.

It there some way to put all of the defined constants into a well-known location, but then not violate Rule 3-4-1 for the singly-used ones?

Print this item

  Memory allocation when throwing an exception.
Posted by: apasternak - 24-07-2018, 12:15 PM - Forum: 6.15 Exception handling (C++) - Replies (1)

Dear all

While doing a memory audit of our framework for autonomous driving cars we realized that throwing any kind of exception dynamically allocates memory on compilers using the Itanium C++ ABI (notably gcc and clang). Further, throwing an exception may block for which is not acceptable for safety-critical real-time systems.

Neither Misra 2008 nor Autosar 14 or other guidelines forbid exceptions in safety-critical environments. What were the considerations when investigating this issue?

To solve this issue we created a library which replaces the dynamic memory allocation with a memory pool. This library is freely available here: https://github.com/ApexAI/static_exception

Any inputs or other approaches would be very welcome!

Best regards,

Andreas

Print this item

  3-9-2 and auto in future MISRA C++14
Posted by: dg1980 - 20-07-2018, 07:32 AM - Forum: 6.3 Basic concepts (C++) - Replies (3)

Hi,

as stated here (https://misra.org.uk/forum/viewtopic.php...1504#p3404) the next version of MISRA C++ will be based on ISO C++14.
I am curious if you already came to a decision on whether to allow or prohibit the auto keyword for automatic type deduction?
While it is certainly more convenient to write code, i would imagine performing a code review or adapting a static analysis tool would become more challenging.

Print this item

  Rule 10.1
Posted by: phdenis - 18-07-2018, 09:30 AM - Forum: 6.10 Arithmetic Type Conversions - Replies (4)

Hello all,

I've an error 10.1 on the following C code:

Code:
#define MyConst 0x8A

My Code Review checker asks to add a U to the constant.

I'm quite surprised if it was a decimal value, I'll understand it but for an hexa, I don't really understand why ?

Another question is to know if a test set is present on the MISRA community to check the correct behaviour of the Code Review tool.

By advance thanks for your help.

B/R
Philippe

Print this item

  MISRA C++ new version
Posted by: ptalwar - 13-07-2018, 09:15 PM - Forum: C++ Announcements - Replies (8)

Is MISRA going to release a new version for C++14 anytime soon?
If so, what does the timeline look like and when it's going to be made available to public?

Print this item

  Why is rule 1.2 classified as undecidable?
Posted by: dg1980 - 13-07-2018, 06:31 AM - Forum: 8.1 A standard C environment - Replies (1)

All you have to do is check the syntax/keywords against the C language standard?
It is even possible with some compilers (e.g. a strict mode)?

Print this item

  5-2-7 and void pointer conversions
Posted by: rgamble - 13-07-2018, 02:32 AM - Forum: 6.5 Expressions (C++) - Replies (1)

Are conversions between pointers to void and pointers to object types a violation of rule 5-2-7? It isn't clear what "object with pointer type" means here (or "unrelated pointer type" for that matter). Specifically, are either of the casts below a violation of Rule 5-2-7?

Code:
void bar(int *ip, void *vp) {
    ip = static_cast(vp);
    vp = static_cast(ip);
}

Print this item

  Conversions outside of the essential type categories
Posted by: gdavis - 10-07-2018, 11:26 PM - Forum: 8.10 The essential type model - Replies (1)

Hello,

With respect to the essential type rules, do conversions to types that are outside the essential type categories count as violations of the rules? For example:

Code:
#include
char buf[80];
char *p = buf;
uintptr_t p_plus_one;
void foo(void);
void foo(void) {
    // This next statement violates R11.4.  But does
    // it violate R10.8?  As a pointer type, p+1 does not
    // have a clear essential type category.
    p_plus_one = (uintptr_t)(p+1);
}
On the one hand, the spirit of the rule seems like it should prohibit such things. On the other hand, TC1 amends rule 10.1 to describe how a pointer type may not be used as an operand of a logical operator.

Thank you for your time.

-Greg

Print this item

  Chapter 6.6.5 Iteration statements
Posted by: sklinger - 06-07-2018, 11:03 AM - Forum: 6.6 Statements (C++) - Replies (2)

Hello,

Regarding the rules 6-5-1, 6-5-2, 6-5-3, 6-5-4, 6-5-5, 6-5-6:
Do these rules only apply to for-loops or do they also apply to while-loops?

best regards,
Stefan

Print this item

Search Forums

(Advanced Search)

Forum Statistics
» Members: 6,206
» Latest member: nileseo4605
» Forum threads: 1,017
» Forum posts: 2,796

Full Statistics

Online Users
There are currently 156 online users.
» 0 Member(s) | 153 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: 160
A3-3-2 Contradictory exam...
Forum: AUTOSAR C++:2014 rules
Last Post: cgpzs
31-03-2025, 09:30 AM
» Replies: 2
» Views: 287
16.6.1 clarification
Forum: 4.16 Overloading
Last Post: cgpzs
31-03-2025, 09:29 AM
» Replies: 2
» Views: 272
Rule 9.3.1 - iteration st...
Forum: 4.9 Statements
Last Post: misra cpp
28-03-2025, 01:17 PM
» Replies: 1
» Views: 181
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: 200
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: 160
Adopted modal expressions...
Forum: General Questions
Last Post: Yordan Naydenov
17-03-2025, 09:01 AM
» Replies: 0
» Views: 245
Roadmap to c23 support
Forum: General Questions
Last Post: ACHart
28-02-2025, 03:23 PM
» Replies: 0
» Views: 202
Rule 6.2.1 weak linkage
Forum: 4.6 Basic concepts
Last Post: misra cpp
28-02-2025, 01:04 PM
» Replies: 1
» Views: 259
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: 675