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

Username
  

Password
  





  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

  Underlying Types
Posted by: gs - 22-11-2004, 06:46 PM - Forum: 6.10 Arithmetic Type Conversions - Replies (3)

I was looking through the MISRA 2 Standard and was wondering what the underlying type of an expression is involving mixed types. For example suppose we are given the following variables:
int i1, i2, *ip;
unsigned char uc;
float f;
What is the underlying type of:
i1 | uc;
i2 ? i1 : uc;
&i1;
ip;
( i1 == i2 );
f;
Since the Standard goes into such detail regarding the concept of \"underlying type\", I feel this is an important issue which, to me, requires clarification.

Print this item

  Dynamic memory allocation using malloc()/calloc()
Posted by: raveendran - 22-11-2004, 09:21 AM - Forum: 6.17 Pointers and Arrays - Replies (2)

Hi,

I have a few queries with respect to \"dynamic memory allocation\". As per the rule we are not supposed to use functions like \"malloc()\", \"free()\", \"calloc()\" etc. But malloc() is a very common requirement. Most of the embedded system applications use their own application level memory managers so as to make the allocation and de-allocation fast. Do you have any suggestions to get around this problem ( if we can't use malloc, any other way )?

One possible solution I can think of right now it to do a static allocation of a big chunk of memory and redirecting all the dynamic memory requirements to that chunk ( basically a kind of memory manager ). But here also we are stuck with one problem. If we write an application level memory manager, it has to cater to all data types. This will require conversion from any data type to \"void*\" and from \"void*\" to any data type ( say \"char*\" ). But Rule No: 45 of MISRA C ( Typecasting from any type to or from pointers shall not be used ) prohibits me doing that also.

The third problem is with writing portable code. Its quite common to use codes like (X*)0->data1 to get the offset to data1 , where X is a structure ( struct X { }; ) and data1 is a member within that structure. Are we not supposed to use these types of casts too [ (X*)0 ] ???

It would be great if someone could give some possible solutions to these kind of issues.

- Thanks
- Raveendran V.

Print this item

  corporate PDF version
Posted by: Erik Leitner - 04-11-2004, 12:38 PM - Forum: General Questions - Replies (3)

Hi,

I'd like to know how the corporate PDF Version of the Misra Rules can be used.
How many people can use it at all and at the same time, does it work like a \"floating license\" ?

Thanks,

Erik

Print this item

  MISRA-C:2004 technical forum presentations
Posted by: david ward - 02-11-2004, 09:31 AM - Forum: Announcements - No Replies

Copies of the presentation material from the recent MISRA C technical forum, held on 14 October 2004, are now available.

Visit the \"Resources\" section of the MISRA C website to find them.

Print this item

  Presentations from MISRA-C Seminar Oct 2004
Posted by: andrzej - 28-10-2004, 11:06 AM - Forum: General Questions - Replies (1)

Will these be made available?

If so where and when?

Best Regards

Andrzej

Print this item

Search Forums

(Advanced Search)

Forum Statistics
» Members: 6,125
» Latest member: suzu
» Forum threads: 968
» Forum posts: 2,660

Full Statistics

Online Users
There are currently 108 online users.
» 0 Member(s) | 105 Guest(s)
Bing, Facebook, Google

Latest Threads
A13-5-4 opposite operator...
Forum: AUTOSAR C++:2014 rules
Last Post: misra cpp
17-05-2024, 03:02 PM
» Replies: 1
» Views: 303
10.2.3 Amplification
Forum: 4.10 Declarations
Last Post: misra cpp
17-05-2024, 02:49 PM
» Replies: 3
» Views: 410
Application of Rule 15.0....
Forum: 4.15 Special member functions
Last Post: nehalpatel
14-05-2024, 06:19 PM
» Replies: 0
» Views: 47
C++17 [[fallthrough]]; at...
Forum: 6.6 Statements (C++)
Last Post: mshawa
22-04-2024, 06:29 PM
» Replies: 0
» Views: 274
cvalue and constant integ...
Forum: AUTOSAR C++:2014 rules
Last Post: misra cpp
19-04-2024, 04:53 PM
» Replies: 1
» Views: 326
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: 292
Rule 7.0.5 Example potent...
Forum: 4.7 Standard conversions
Last Post: misra cpp
12-04-2024, 01:54 PM
» Replies: 1
» Views: 276
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: 310
Further guidance on MISRA...
Forum: 8.10 The essential type model
Last Post: mshawa
09-04-2024, 02:29 PM
» Replies: 0
» Views: 258
MISRA AC SLSF:2023 AMD1
Forum: MISRA AC resources
Last Post: david ward
05-04-2024, 01:56 PM
» Replies: 0
» Views: 267