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

Username
  

Password
  





  Function returning pointer to array - Rule 17.4
Posted by: Greg Middleton - 24-06-2010, 01:24 PM - Forum: 6.17 Pointers and Arrays - Replies (5)

I have a function returning a pointer to an array, not an uncommon situation I would think.
How can I reference elements in that array without violating Rule 17.4 ?.
1. Indexing is not compliant as the return type is not an array.
2. Pointer arithmetic is not compliant.
So it looks like returning pointers to arrays is effectively banned by this rule, is that the case?.

Print this item

  what means about "Before preprocessing" in Rule[14.3]
Posted by: linglingma - 23-06-2010, 12:33 PM - Forum: 6.14 Control Flow - Replies (3)

"Before preprocessing, a null statement shall only occur on a
line by itself; it may be followed by a comment provided that
the first character following the null statement is a white-space
character." in this rule,why "Before preprocessing"is used as a condition?
Thanks!

Print this item

  about rule20_5
Posted by: Manisha Nikambe - 15-06-2010, 06:38 AM - Forum: 6.20 Standard Libraries - Replies (2)

void func()
{
int errno;//does even declaration of errno violates rule20_5,errno is user defined?
}

Print this item

  Assigning literal 0 to an unsigned variable
Posted by: gs - 11-06-2010, 03:45 PM - Forum: 6.10 Arithmetic Type Conversions - Replies (3)

Should literal 0 be exempt from rule 10.1? True, rule 10.6 requires a 'U' suffix in this case. However, what about in regards to rule 10.1 by itself?

Print this item

  about rule20.5
Posted by: raghaw_k - 25-05-2010, 12:18 PM - Forum: 6.20 Standard Libraries - Replies (8)

According to the rule 20.5, error indiaction facility should not be used even if it is well defined.
1)Is it mean that we should not declare the identifier(function and variable) with the name "errno"?
2)As per the standard library for linux "errno" MACRO is defined to function pointer call and for Visual C++ it is extern variable declaration. So does usage of "errno"(i.e. function call) on linux also violates the rule 20.5?

Print this item

  MISRA usage
Posted by: ggentile - 12-05-2010, 06:23 PM - Forum: General Questions - No Replies

We bought a single license for MISRA C document. We are developping an internal tool to check MISRA rules, is it possible to use the description of each rule in the helper of the tool ?
Or exist any restriction also in the usage of the rules description ?

Giacomo

Print this item

  Was something missed for 12.6 about "?:"?
Posted by: gs - 06-05-2010, 03:25 PM - Forum: 6.12 Expressions - Replies (1)

The wording of advisory #12.6 indicates expressions other than effectively boolean ones are permitted as the conditional argument to "?:". Was this wording an oversight? In three other circumstances, the guidelines insist on effectively boolean expressions and it seems unintuitive to not require such in this case as well.

Print this item

  namelengthmax
Posted by: ggentile - 29-04-2010, 10:29 AM - Forum: MISRA AC SLSF discussions - Replies (3)

I didn't find any limitation in MISAR AC* in the usage of matlab lenght identifier.

Where I am wrong ?

Giacomo

Print this item

  6.4 and 6.5 with respect to unnamed bit fields?
Posted by: gs - 27-04-2010, 04:24 PM - Forum: 6.6 Types - Replies (1)

Do rules #6.4 and 6.4 apply to unnamed bit fields? I would think, since the such fields are unnamed, one would not easily access them.

Print this item

  Assembly encapsulation in macros?
Posted by: gs - 26-04-2010, 06:41 PM - Forum: 6.2 Language Extensions - Replies (1)

Is this code compliant with rule #2.1?

Code:
#define ASM_MACRO_1 asm { "abc" }
#define ASM_MACRO_2 asm { "xyz" }

extern void g();

void f( void )
    {
    ASM_MACRO_1;    /* Do something in assembly.    */
    g();            /* Do something in C.           */
    ASM_MACRO_2;    /* Do something in assembly.    */
    }

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 156 online users.
» 0 Member(s) | 152 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: 624
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: 427
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: 723
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: 536