Bugs item #3007799, was opened at 2010-05-27 09:29
Message generated for change (Comment added) made by maartenbrock
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100599&aid=3007799&group_id=599
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: wek (wek_)
Assigned to: Nobody/Anonymous (nobody)
Summary: Different warning for string initializer fitting without /0
Initial Comment:
The following initialization:
char a2[3]="foo";
currently (2.9.7, #5826, May 19 2010) causes
f1.c:2: warning 147: excess elements in string initializer after 'a2'
presumably because of the trailing null character.
However, this is a legal initializer as per C99, §6.7.8 item 14, which allows to omit the trailing null character if it won't fit into the array.
On the other hand, for this particular case, I'd issue a different, pedantic, warning, as it may be a source of confusing errors for those who are not aware of this issue.
Jan Waclawek
----------------------------------------------------------------------
>Comment By: Maarten Brock (maartenbrock)
Date: 2010-05-27 13:31
Message:
I consider this a bug and have therefor moved it.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100599&aid=3007799&group_id=599
|