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

Username
  

Password
  





  Rule 4-5-1 prohibits 'b1 |= b2;' ?
Posted by: grunwald - 28-09-2016, 02:00 PM - Forum: 6.4 Standard conversions (C++) - Replies (3)

Neither `|` nor `|=` is listed as allowed operator.
Does this mean the following code a violation of Rule 4-5-1?

Code:
bool b1 = false;

void f(int x)
{
    b1 |= (x == 0);
}

Print this item

  Rule 0-1-9
Posted by: dg1980 - 28-09-2016, 12:52 PM - Forum: 6.0 Language independent issues (C++) - Replies (1)

Please add an explicit exception for static_assert if the next MISRA C++ version allows C++11.
Thanks.

Print this item

  Rule 5-0-19 are references also considered a 'pointer indirection'?
Posted by: grunwald - 23-09-2016, 03:45 PM - Forum: 6.5 Expressions (C++) - Replies (1)

More concretely, is the following code a violation?

Code:
typedef void **my_t;

void f(my_t& x)
{
   x = NULL;
}

Print this item

  Synchronization with MISRA C 2012
Posted by: dg1980 - 21-09-2016, 12:27 PM - Forum: 6.18 Language support library (C++) - Replies (1)

Dear MISRA team,

i recently stumbled upon Rule 21.9 of MISRA C 2012 which prohibits use of bsearch/qsort.
Currently, there is no equivalent in MISRA C++ 2008, so it would be legal to use bsearch/qsort in C++ (if you use cstdlib that is).
Maybe this is another synchronization topic for the next version of the standard (along with the preprocessor usage, see https://misra.org.uk/forum/viewtopic.php...1549#p3031).
Thanks.

Print this item

  Rule 5-0-12
Posted by: dg1980 - 15-09-2016, 12:53 PM - Forum: 6.5 Expressions (C++) - Replies (2)

From the official text:

Code:
uint8_t b = '\r';//Non-compliant, explicitly unsigned
Would a static_cast turn this into a compliant statement?
Code:
uint8_t b = static_cast('\r');//Compliant
Static analysis tool used says yes, hence the question.

Print this item

  Does Rule 11.9 allow indirect expansion from NULL?
Posted by: rgamble - 14-09-2016, 02:23 PM - Forum: 8.11 Pointer type conversions - Replies (3)

Does the following example violate Rule 11.9?

Code:
#define FOO NULL
int32_t *p1 = FOO;

Print this item

  Rule 3.1 - Hyperlinks in comments?
Posted by: Andrew Banks - 02-09-2016, 11:00 AM - Forum: 8.3 Comments - Replies (2)

Cross-post from the MISRA C/C++ LinkedIn group

Quote:Is there any chance MISRA could alter Rule 3.1 to allow common hyperlinks in C comments such that a Deviation isn't required:

Code:
/*
* See https://somewhere.over.the.rainbow/way/up/high.htm
*/

I use direct references to RFCs in source files that allow clicking in Visual Studio to open up a browser at the relevant spec. MISRA sees this as evil. If https: or http: occurs before //, then there isn't much confusion about commenting...

The (perfectly sound) Rationale for the Rule is to detect missing */ comment terminators.

There is already an Exception to permit // within a */ comment... so a further Exception to permit hyperlinks of the form http://, https://, ftp:// or ftps:// (without requiring a Deviation) seems reasonable?

Print this item

  Directive 4.5
Posted by: dg1980 - 01-09-2016, 11:59 AM - Forum: 7.4 Code design - Replies (1)

Dear MISRA team,

please read the text carefully and then read MISRA C++ 2008 Rule 2-10-1.
It is virtually identical but in C++ it is rated required and in C it is rated advisory.
Was that a change on purpose or an accident?
Thanks.

Print this item

  Rule 1.3 - What do people do to check this rule?
Posted by: delta_controls - 23-08-2016, 02:04 PM - Forum: 8.1 A standard C environment - Replies (13)

Hi,

Of the 191 undefined behaviours listed in C99, there are 61 that have no associated MISRA guideline. Checking all of these is particularly labourious, especially as the list in Annex J is not numbered.

How do people go about checking conformity with this catch-all rule?

Does anyone globally deviate from this rule, since the most important and most likely behaviours are addressed by other guidelines and checking the others is not practical?

Thanks.

Print this item

  Rule 2.2 - dead code
Posted by: delta_controls - 25-07-2016, 01:16 PM - Forum: 8.2 Unused code - Replies (4)

Does the following code example violate Rule 2.2, due to the left shift?

[code]#define BITSET(reg, bit) ((reg) |= (uint8_t)(1u

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 59 online users.
» 0 Member(s) | 55 Guest(s)
Bing, Facebook, 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: 725
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: 436
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