const char wd[6] = "Wednes", is that legal?
Axel Freyn
axel-freyn@gmx.de
Tue Nov 30 17:25:00 GMT 2010
Hi Joakim,
On Tue, Nov 30, 2010 at 03:40:12PM +0100, Joakim Tjernlund wrote:
> gcc 4.4.5, powerpc32 does not fail
> const char wd[6] = "Wednes";
> even though wd only has room for 6 chars. Is this intended?
Which language are you using? ;-)
In C++, it's forbidden (there has to be enough space for the implied
trailing "\0".
In C whoever, it's legal -- you obtain an array of 6 characters, without
a trailing "\0" ...
Axel
More information about the Gcc
mailing list