13-01-2011, 09:14 AM
Perhaps you get the warning because the array is too small: C strings are null-terminated. Correct code would be content[5] or content[]. Do you get the same warning if you write
char content[4] = {'a','b','c','d','\0'};
Apart from that bug, I don't think you should get any warning, though one can't really blame the tool vendor from generating it, as rule 9.2 doesn't actually mention strings at all. Perhaps some text should be added to 9.2 mentioning string initialization.
char content[4] = {'a','b','c','d','\0'};
Apart from that bug, I don't think you should get any warning, though one can't really blame the tool vendor from generating it, as rule 9.2 doesn't actually mention strings at all. Perhaps some text should be added to 9.2 mentioning string initialization.
<t></t>