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

Username
  

Password
  





  MISRA C:1998 Rule 113
Posted by: aekalman - 15-06-2005, 04:08 PM - Forum: General Questions - Replies (2)

Hello All.

I am running the comercial RTOS Salvo through the MISRA checker as implemented in IAR's EWARM v4.20A tool suite.

I have a struct called ecb which in turn contains a field called tcbP. ecbP is a pointer to the struct ecb. OSeligQP is a pointer to a struct tcb.

The IAR MISRA checker complains about a call to a function

Code:
OSInsPrioQ(OScTcbP, &(ecbP->tcbP));

whereas it's fine with

Code:
OSInsPrioQ(OScTcbP, &OSeligQP);

Now, I admit that I do not know MISRA views passing a parameter by reference, but it certainly doesn't disallow it. In my example, a member of a struct is being passed by reference (not by value), and is being accessed by name, as per MISRA.

So, is this legal in MISRA-C?

Thanks for any and all input.

--Andrew

Print this item

  List of Companies using MISRA C Guidelines in coding
Posted by: Babita Sharma - 14-06-2005, 07:47 AM - Forum: General Questions - Replies (1)

I belong to the Formal Verification group of Bhabha Atomic Research Centre. I wish to promote the use of MISRA C guidelines in my company. A list of companies in various sectors such as aerospace and military, that have accepted MISRA C standards, will help me a lot. May I ask the members of this group to help me.

Babita.

Print this item

  Code Formatter / Beautifyer for 14.8 and 14.9 ?
Posted by: bmerkle - 04-05-2005, 11:45 AM - Forum: 6.14 Control Flow - Replies (3)

Hi there,

is there any Code Formatter / Beautifyer that reformats C code according to the MISRA rules, e.g. MISRA2 Rule 14.9 or Rule 14.8 or MISRA1 Rule59 ?

I know of artistic style (on sf) but unfortunately it has not the rule

kind regards,
Bernhard.

Print this item

  Nominal or Physical?
Posted by: gs - 23-03-2005, 12:05 AM - Forum: 6.10 Arithmetic Type Conversions - Replies (5)

10.1a prohibits implicit conversions of an integer expression if it is not to a type wider than the underlying type (and of the same signedness). Suppose ints are the same size as shorts on my system, can I implicitly convert an short to an int? Technically, the ints are not wider than shorts, but nominally, they are. Any thoughts?

Print this item

  Rule 104 question on function pointers
Posted by: foobarista - 03-03-2005, 09:40 PM - Forum: 6.16 Functions - Replies (1)

Our product makes use of a \"service-based\" architecture - and, while it is \"good code\" that runs on 16, 32, and 64 bit environments, it wasn't initially written with MISRA compliance in mind, although we're \"pretty close\". The tricky one is Rule 104...

Anyway, since networking, IPC, and other typical PC-and-up options for doing services aren't often available in constrained embedded environments, we've chosen function pointers and a \"registration\" methodology as our approach. We're an ISV that works with customers who typically write services themselves or use one of several service implementations that we provide. Services are things like file-system API interfaces, flash I/O interfaces, memory management, etc.

So, I have a question about Rule 104: it would seem that Rule 104 disallows this sort of approach, if I read it right: services are ultimately dynamically-created structures that contain arrays of function pointers that execute the different operations of the service.

The only \"get out of jail free\" card that I can see is that these pointers are set only once at registration time and not changed while the instance of the service exists. But the function pointers are initialized at runtime, so it would seem that we're still in violation of Rule 104.

Is \"initialized at runtime\" versus \"initialized at compile-time\" the test for Rule 104 compliance? Or is it \"a function pointer that is changed\", versus one that is initialized once, whether at compile or runtime, and not changed afterward?

Print this item

  Questions about 18.3
Posted by: bigpan - 28-02-2005, 12:30 PM - Forum: 6.18 Structures and Unions - Replies (1)

I have the following patterns, anybody please kindly give me some advises on them.

/*pattern1*/
int counter;
for (counter = 0; counter < 100; counter++)
{...}
...
counter = a*b;

Print this item

  13.5 for() loops
Posted by: matth1j - 25-02-2005, 05:02 PM - Forum: 6.13 Control Statement Expressions - Replies (2)

Hi

Rule 13.5 (required) states: \"The 3 expressions of a for statement shall be concerned only with loop control\", and
\"First expression: initialising the loop counter.
Second expression: shall include testing the loop counter, and optionally other loop control variables.
Third expression: increment or decrement of the loop counter.\"

The implication would appear to be that for() loops should only be used where there is a loop counter. Is that correct, or could you (for example) use a for() loop without a loop counter, in which case there wouldn't be a first expression?

Is the idea to restrict C's for() usage to that of Pascal's ie.

for var := first [ to | downto ] last do ...

? I'm Ok with this, but I feel that either I'm missing something or the rule isn't explicit enough about what for() can and can't be used for.

Regards
John
NEC Technologies (UK)

Print this item

  Underlying types for bit-fields
Posted by: gs - 21-02-2005, 02:41 PM - Forum: 6.10 Arithmetic Type Conversions - Replies (2)

Can any one tell me how to determine the underlying type of a bit-field? We need to know in order to incorporate testing for MISRA 2 compliance in our product.

Print this item

  MISRA replies to rule questions
Posted by: david ward - 10-02-2005, 01:25 PM - Forum: Announcements - No Replies

You will notice that a few questions have been asked about the rules.

The MISRA C Working Group will review such questions from time to time and, where appropriate, give a considered response. Such a response will be posted under the name \"MISRA Reply\".

Please note that as MISRA is a voluntary activity, we may not be able to respond to every question; nor to guarantee responding to questions within a particular timescale. However, we do intend to post answers to the questions on a semi-regular basis from this time onwards.

Print this item

  Solutions and workarounds to things prohibited in MISRA C
Posted by: MISRA Reply - 10-02-2005, 01:19 PM - Forum: General Questions - No Replies

We have been asked a number of questions about solutions and workarounds for various things that are prohibited in both MISRA C1 and MISRA C2 such as using malloc, calloc, etc. for dynamic memory allocation.

Neither MISRA or any member of the MISRA C Working Group will give any guidance or approval to any deviation or \"workaround\". Any advice that may be given by any individuals associated with MISRA C is entirely personal and is not to be seen as a comment from MISRA or the MISRA C Working Group. In general the advice we would give is:

Where you have decided it is not possible to comply with a rule you should raise a deviation giving your reasons and justifications for doing so. You will have to take documented responsibility for your own deviations.

Read Section 4 (of MISRA-C:2004) on using MISRA C, specifically section 4.3.2 on deviations which outlines how to use deviations.

In general deviations should be as local as possible and as specific as possible and must be subject to sign-off for each deviation (or class of deviation).

Remember YOU will have to take responsibility for your deviations.

Print this item

Search Forums

(Advanced Search)

Forum Statistics
» Members: 6,121
» Latest member: Alain.Djempe
» Forum threads: 968
» Forum posts: 2,657

Full Statistics

Online Users
There are currently 180 online users.
» 0 Member(s) | 178 Guest(s)
Bing, Google

Latest Threads
A13-5-4 opposite operator...
Forum: AUTOSAR C++:2014 rules
Last Post: aromauld
26-04-2024, 03:34 PM
» Replies: 0
» Views: 66
C++17 [[fallthrough]]; at...
Forum: 6.6 Statements (C++)
Last Post: mshawa
22-04-2024, 06:29 PM
» Replies: 0
» Views: 73
cvalue and constant integ...
Forum: AUTOSAR C++:2014 rules
Last Post: misra cpp
19-04-2024, 04:53 PM
» Replies: 1
» Views: 231
Rule 6-2-3 and C++17 [[fa...
Forum: 6.6 Statements (C++)
Last Post: misra cpp
19-04-2024, 04:48 PM
» Replies: 1
» Views: 203
10.2.3 Amplification
Forum: 4.10 Declarations
Last Post: misra cpp
12-04-2024, 02:20 PM
» Replies: 1
» Views: 239
Rule 7.0.5 Example potent...
Forum: 4.7 Standard conversions
Last Post: misra cpp
12-04-2024, 01:54 PM
» Replies: 1
» Views: 185
Rule 0.2.4 non-compliant ...
Forum: 4.0 Language independent issues
Last Post: misra cpp
12-04-2024, 01:51 PM
» Replies: 1
» Views: 217
Further guidance on MISRA...
Forum: 8.10 The essential type model
Last Post: mshawa
09-04-2024, 02:29 PM
» Replies: 0
» Views: 134
MISRA AC SLSF:2023 AMD1
Forum: MISRA AC resources
Last Post: david ward
05-04-2024, 01:56 PM
» Replies: 0
» Views: 153
MISRA AC GMG:2023 release...
Forum: MISRA AC GMG discussions
Last Post: misra-ac
25-03-2024, 06:01 PM
» Replies: 2
» Views: 533