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

Username
  

Password
  





  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

  Rule 14
Posted by: leire - 04-02-2005, 12:44 PM - Forum: 6.6 Types - Replies (4)

Funtions with parameter of type char as for example \"strcpy\" I can not use signed or unsigned char. Eventhoug the compiler specifies that char is signed, whenever you call strcpy with signed char, there is a compilation error, but if we use the parameter of type char, then we violate rule 14. Does this mean that we must generate our own string manipulation functions?

Print this item

  Underlying Type Presumptions
Posted by: gs - 07-01-2005, 03:13 PM - Forum: 6.10 Arithmetic Type Conversions - Replies (3)

I have made some presumptions regarding the MISRA 2004 concept of Underlying Type. Do correct me if I am wrong in these presumptions.

1. Explicit casts change an expression's underlying type
2. The Standard is not concerned with an expression's underlying type if any of its sub-expressions violate a required underlying type-related rule
3. Implicitly converting an expression (excluding promotions) change its underlying type
4. Effectively Boolean expressions have underlying type of int (see commentary in MISRA 2004, 6.10.2)
5. Enums and enumerations constants have underlying type of int (see C90 Standard, Clause 3, Section 1, Sub-section 3, Part 3)

Does anyone see a problem with any of these?

Print this item

  What about Macros for 14.3?
Posted by: gs - 20-12-2004, 06:59 PM - Forum: 6.14 Control Flow - Replies (2)

Expanding upon the example in the MISRA 2004 Standard for 14.3:


#define WHATABOUTTHIS /* Um */ ;
#define ORTHIS
#define ANDTHISTOO /* Well, I, uh... */

void f()
{
; /* OK */
/* Not OK */ ;
;/* Not OK */
WHATABOUTTHIS
ORTHIS;
ANDTHISTOO;
}

Which of the lines with macros, if any, violate the Rule?

Print this item

  Digests - did anyone try?
Posted by: Erik Leitner - 13-12-2004, 06:28 AM - Forum: General Questions - Replies (5)

Hi everybody,
did anyone of you try the digests function of this MISRA Bulletin Board ?
It seems to me that I got the message \"no posts\" (as usually :-) )although there was a post in a subforum of the misra-rules-forum on Dec 8 and I don't think I have been logged in since then.
(I selected weekly digest)

Erik

Print this item

  What about '\\0'?
Posted by: gs - 08-12-2004, 09:03 PM - Forum: 6.7 Constants - Replies (3)

Does Rule 7.1, \"No octal constants (other than zero) and octal escape sequences shall not be used,\" permit the use of the null character, '\\0'? The normative and rule text exempt 0, per se, but make no mention about '\\0'. Prohibitting '\\0' runs, IMHO, contrary to the Principle of Least Surprise. Perhaps someone would show such kindness as to provide me with some clarity?

I appreciate your time in advance.

Print this item

Search Forums

(Advanced Search)

Forum Statistics
» Members: 6,207
» Latest member: [email protected]
» Forum threads: 1,017
» Forum posts: 2,800

Full Statistics

Online Users
There are currently 119 online users.
» 0 Member(s) | 115 Guest(s)
Applebot, Bing, Google, UptimeRobot

Latest Threads
About MISRA-C 2023 Permit
Forum: General Questions
Last Post: misra-c
Yesterday, 08:37 AM
» Replies: 1
» Views: 852
MISRA 2023 Test Suite
Forum: General Questions
Last Post: misra-c
Yesterday, 08:35 AM
» Replies: 1
» Views: 814
Roadmap to c23 support
Forum: General Questions
Last Post: misra-c
Yesterday, 08:34 AM
» Replies: 1
» Views: 232
Typo in Appendix C of MIS...
Forum: 8.10 The essential type model
Last Post: misra-c
Yesterday, 08:21 AM
» Replies: 1
» Views: 203
Rule 7.0.5, example non-c...
Forum: 4.7 Standard conversions
Last Post: cgpzs
17-04-2025, 12:10 PM
» Replies: 0
» Views: 201
A3-3-2 Contradictory exam...
Forum: AUTOSAR C++:2014 rules
Last Post: cgpzs
31-03-2025, 09:30 AM
» Replies: 2
» Views: 337
16.6.1 clarification
Forum: 4.16 Overloading
Last Post: cgpzs
31-03-2025, 09:29 AM
» Replies: 2
» Views: 319
Rule 9.3.1 - iteration st...
Forum: 4.9 Statements
Last Post: misra cpp
28-03-2025, 01:17 PM
» Replies: 1
» Views: 203
Rule 8.2.8 - why aren't a...
Forum: 4.8 Expressions
Last Post: misra cpp
28-03-2025, 01:05 PM
» Replies: 1
» Views: 232
Adopted modal expressions...
Forum: General Questions
Last Post: Yordan Naydenov
17-03-2025, 09:01 AM
» Replies: 0
» Views: 310