Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A question for Amplification of Rule 3.2.
#1
I have a question for Amplification of Rule 3.2.

Your guideline has the following description in item "Amplification" of Rule 3.2.

"If the source file contains multibyte characters, they are converted to the source character set before any splicing occurs."

However, I did not understand the aim of this description well. Will you explain the details?

Especially, I do not understand why "multibyte characters" are related to "splicing".

Do you intend to explain the supporting case ,"multibyte characters including "\" character"?

I suppose it as follows.

"\" character included in "multibyte characters" is different from "line-splicing \",so there are not mixed.

For example,
uint16_t x=0; // 表
if( b)
{
x++;
}

Even If this character"表" incudes "\" character,
this "\" is not a meaning of "line-splicing".


Is this correct?

Please teach me.

Best Regards,
Kumiko Itoh
<t></t>
#2
The line in the amplification is present to remind readers that the interpretation of bytes in the physical source file occurs in translation phase 1 and the line splicing in translation phase 2.

For example, in UTF16 the 表 "han honour" multi-byte character corresponds to the bytes 0x5C0A.

If the physical source file was interpreted as an ASCII file, the bytes sequence 0x5COA would be interpreted as backslash (0x5C) and new line (0x0A);

This rule applies to characters rather than byte sequences. There will be no violation of this rule, providing the analyser has done a correct translation according to translation phase 1 in the standard as implemented by the compiler.
Posted by and on behalf of the MISRA C Working Group
#3
Hi,

I had a simple doubt regarding the code snippet provided here. Does usage of '//' for commenting violate any rule because '//' was initially introduced in C++ and I wonder if it can be used with a C compiler? [Note: I am really new to this forum and I am studying the various MISRA C Guidelines.]

Please enlighten me in this topic.

Regards,
Mukund Iyer
<t></t>
#4
The // comment was introduced in C99 and is permitted by the MISRA guidelines if the project is using C99. If the project is using C90 the use of // will violate rule 1.2 "Language extensions should not be used".
Posted by and on behalf of the MISRA C Working Group


Forum Jump:


Users browsing this thread: 1 Guest(s)