A question for Amplification of Rule 3.2. - Printable Version +- MISRA Discussion Forums (https://forum.misra.org.uk) +-- Forum: MISRA C (https://forum.misra.org.uk/forumdisplay.php?fid=4) +--- Forum: MISRA C:2012 and MISRA C:2023 guidelines (https://forum.misra.org.uk/forumdisplay.php?fid=21) +---- Forum: 8.3 Comments (https://forum.misra.org.uk/forumdisplay.php?fid=158) +---- Thread: A question for Amplification of Rule 3.2. (/showthread.php?tid=1063) |
A question for Amplification of Rule 3.2. - KumikoItoh - 09-06-2014 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 Re: A question for Amplification of Rule 3.2. - misra-c - 25-06-2014 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. Re: A question for Amplification of Rule 3.2. - mukundi - 19-09-2018 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 Re: A question for Amplification of Rule 3.2. - misra-c - 04-10-2018 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". |