Path: chuka.playstation.co.uk!news From: "pal" Newsgroups: scee.yaroze.freetalk.english Subject: Re: Ten bytes bug in gcc? Date: 14 Aug 2001 21:58:14 GMT Organization: PlayStation Net Yaroze (SCEE) Lines: 21 Message-ID: <01c1250b$c7e92d60$501ce4d5@pal-s-omnibook> References: <01c124b1$16cc8cc0$LocalHost@pal-s-omnibook> <9lbptg$fio2@www.netyaroze-europe.com> NNTP-Posting-Host: nas-cbv-2-28-80.dial.proxad.net X-Newsreader: Microsoft Internet News 4.70.1155 Omar wrote in article <9lbptg$fio2@www.netyaroze-europe.com>... >you might want to make it unsigned char test[11] instead so that > the last one is NULL value. > Standard libraries string functions (such as printf, scanf, strlen...) require and produce strings of chars ended by '\0'; and string constants end with '\0'. This is the reason why strings usually end with an '\0'. But here the array is not meant as a string, it's just a piece of memory. The type char/unsigned char is always 8bit wide, this is why I use it in the example, so as to be sure of the physical size of the array. Originally I encountered the problem with a ten-byte struct. In the faulty code no use is made of the array, the declaration suffices to cause the crash, this is the weird thing. pal