public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* const char wd[6] = "Wednes", is that legal?
@ 2010-11-30 15:08 Joakim Tjernlund
  2010-11-30 17:25 ` Axel Freyn
  0 siblings, 1 reply; 2+ messages in thread
From: Joakim Tjernlund @ 2010-11-30 15:08 UTC (permalink / raw)
  To: gcc


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?

      Jocke

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: const char wd[6] = "Wednes", is that legal?
  2010-11-30 15:08 const char wd[6] = "Wednes", is that legal? Joakim Tjernlund
@ 2010-11-30 17:25 ` Axel Freyn
  0 siblings, 0 replies; 2+ messages in thread
From: Axel Freyn @ 2010-11-30 17:25 UTC (permalink / raw)
  To: gcc

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-11-30 14:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-30 15:08 const char wd[6] = "Wednes", is that legal? Joakim Tjernlund
2010-11-30 17:25 ` Axel Freyn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).