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

Username
  

Password
  





  Rules 11.4 and 11.5: addressing only explicit cast ?
Posted by: lv - 19-10-2006, 12:06 PM - Forum: 6.11 Pointer Type Conversions - Replies (1)

Theses both rules (11.4 and 11.5) prevents against bad casting between pointers.


In my understanding, these both rules are applicable for explicit and implicit cast: The problematic is the same for explicit or implicit cast.


The understanding of my MISRA-checker-tools is that these rules address only explicit cast (these rules give only explicit cast example, and anywhere implicit cast is mentioned).
And this pointer implicit cast is not covered by another MISRA rule (Rules 10.1 and 10.2 don't address pointers cast but only integer and float implicit casts.)

Could you confirm which understanding is the good one?

Thanks in advance.

Print this item

  11.2 Interpretation
Posted by: elmar - 16-10-2006, 06:54 AM - Forum: 6.11 Pointer Type Conversions - Replies (1)

With rule 11.2,

\"Conversions shall not be performed between a pointer to object and any type other than an integral type, another pointer to object type or a pointer to void\"

my understanding of the term

\"another pointer to object type\"

is, that for example code like

int* Source;
long* Target;
Target = (long*)Source;

doesn't violate this rule (but at least violates rule 11.4);
but our misra checker tool's interpretation of this rule is more like

\"another pointer to same object type\"

therefore it emits a misra violation for code structures like the one mentioned above.

To help me out, could you please tell me which interpretation is right?

Thanks in advance,
elmar

Print this item

  unnamed members of a structure
Posted by: rahul_mishra - 13-10-2006, 04:37 AM - Forum: 6.18 Structures and Unions - Replies (1)

Please let me know \"How do we access an unnamed member of a structure\"?

Its quite natural to use bitfields as unnamed members of a structure especially for padding. But, how do we access those unnamed members. Do we have to increment the pointer to access it? if yes, please illustrate it with an example.

Print this item

  12.4 and Non-Returning Functions
Posted by: gs - 03-10-2006, 01:33 PM - Forum: 6.12 Expressions - Replies (1)

Hi,
12.4 prohibits side-effects on the right hand side of '&&' or '||'. What if, on the right hand side, I place a function with no side-effects, provided it returns, but which does contain side-effects if it does not return (e.g., an assertion which writes to a log file of some sort)? Is such a function allowed on the right hand side of the logical operators?

Print this item

  8.5 and a C99 Extension
Posted by: gs - 03-10-2006, 01:26 PM - Forum: 6.8 Declarations and Definitions - Replies (1)

Hi,
I use 'inline' within my code. Not wanting to go into any details, let us just suffice it to say I feel sufficient reason exists for me to do so. Does 8.5 apply to inline functions? Does the use of 'inline' supercede the restriction of 0 function definitions per header?

Print this item

  64 bit data types?
Posted by: mhabermann - 22-09-2006, 12:05 PM - Forum: 6.6 Types - Replies (1)

Hello!

Rule 6.3 of MISRA-C lists the typedefs for uint64_t and int64_t, which I believe are not used anymore in the standard and should be disallowed by C90.

Can you confirm that uint64_t and int64_t datatypes are not allowed?


Best Regards

Michael

Print this item

  18.1 All structure or union types shall be complete at...
Posted by: srogers - 18-09-2006, 12:16 PM - Forum: 6.18 Structures and Unions - Replies (1)

Quote:18.1 All structure or union types shall be complete at the end of a translation unit.
A complete declaration of the structure or union shall be included within any translation unit that refers to that structure.

If my interpretation of this rule is correct then it prohibits the use of opaque pointers. (I wish to use these to hide the contents of structures, so that access is only via certain functions.)

Was the prohibition of opaque pointer use deliberate? If so what are the concerns?

Print this item

  Date for Technical Clarification Misra c:2004
Posted by: Hammer - 31-07-2006, 10:46 AM - Forum: General Questions - No Replies

Hello. I have some open qusetions on the forum and am also interested in some of the other open questions anout MISRA C: 2004.

I have heard that a TC will be written or already has been written to clarify some of these topics.

If possible it would be great if you could provide an estimated date that this will me made available.

Thanks a lot

Print this item

  verify generated code with MISRA-C ?
Posted by: bmerkle - 21-07-2006, 05:41 AM - Forum: General Questions - Replies (2)

Hi there,

when using a UML modelling tool, should (according to MISRA) the generated code be verified, e.g. with MISRA-C ?

My experience is, that generated code often violates MISRA-C rules
and in IMO this is not a major issue, as you have to \"trust\" you codegenerator anyway ;-)

I think a better approach is, to verify the MODEL (and not the code) with some sort of model-checking...

Will the UML-group of MISRA produce such rules to verify against models ?

any other opinions, experiences ?

kind regards,
Bernhard.

Print this item

  Rule 5.6 / Rule 5.7
Posted by: sparker - 20-07-2006, 03:48 PM - Forum: 6.5 Identifiers - Replies (2)

I'm confused by the difference between the two examples in these two rules. In R5.6 we're shown that it is ok to reuse the structure member identifier \"next\" since \"member names are less likely to be confused\", and in R5.7 we're shown that members of two different structure types cannot have the same name (\"speed\").

Is the intention that one deviates from R5.7 leaving R5.6 to catch the most important cases? If so that isn't very clear from the text.

(Overall I'd be surprised if anyone ever sticks to R5.7 since it means that every identifier in your program, even every local, has to differ from every other. That means no \"i\", \"j\", \"p\", \"speed\", \"rpm\", ..., \"index\", etc.)

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 91 online users.
» 0 Member(s) | 86 Guest(s)
Bing, DuckDuckGo, 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: 425
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,031
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: 717
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: 434
M5-0-4 switch over unscop...
Forum: 6.5 Expressions (C++)
Last Post: misra cpp
25-09-2026, 01:00 PM
» Replies: 3
» Views: 532