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

Username
  

Password
  





  Rule 8.3 type qualifier
Posted by: Motozo Mario Ikeda - 07-10-2016, 01:38 AM - Forum: 8.8 Declarations and defnitions - Replies (3)

"Type qualifier" and "Storage class specifier" are mentioned in Rule 8.3, but "Type specifier" is not.

Should we think "Type qualifier" includes "Type specifier"?

Thank you,
Mario Ikeda

Print this item

  Casting integer to floating point
Posted by: bobvanderputten - 04-10-2016, 12:46 PM - Forum: 6.10 Arithmetic Type Conversions - Replies (2)

I have the following code:

int16_t int_torque_I_MUL;
float32_t f_temp1;
...
f_temp1 = (float32_t)(int_torque_I_MUL);
...
The above will generate:
MISRA-C:2012 R.10.1,R.10.3,R.10.4,R.10.5,R.11.1: Value is not of appropriate type. : (double and short)
But I don't understand why??
How can I cast a signed 16 bit integer to a double (float32_t )?

Print this item

  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

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 377 online users.
» 0 Member(s) | 374 Guest(s)
Applebot, Bing, Google

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