Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
6.2 With Respect to Arrays and Pointers?
#1
Is the following code permitted or prohibited by rule 6.2?
Code:
signed char a[10] = {"123456789"};
signed char *b = "123456789";
Reply
#2
Neither of the examples given is permitted by Rule 6.2..

Here are some more examples:

Code:
signed char a[10] = "123456789";   /* Non-compliant Rule 6.2 */
char a[10] = "123456789";          /* Compliant Rule 6.2 */

char x[4] = {1, 2, 3, 4};          /* Non-compliant Rules 6.2 and 6.3 */
Posted by and on behalf of the MISRA C Working Group
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)