Date: Sat, 11 Jun 2005 10:45:24 -0700 From: Marcel Moolenaar <marcel@xcllnt.net> To: Stefan Farfeleder <stefanf@FreeBSD.org> Cc: cvs-src@FreeBSD.org, src-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/dev/ata ata-raid.c Message-ID: <ca3b2ad2c8f54a10d44a4ca5512ce778@xcllnt.net> In-Reply-To: <20050611072537.GB39090@wombat.fafoe.narf.at> References: <200506110321.j5B3LKi2025443@repoman.freebsd.org> <20050611072537.GB39090@wombat.fafoe.narf.at>
next in thread | previous in thread | raw e-mail | index | archive | help
On Jun 11, 2005, at 12:25 AM, Stefan Farfeleder wrote: > On Sat, Jun 11, 2005 at 03:21:20AM +0000, Marcel Moolenaar wrote: > >> Avoid GCC optimizations from injecting a call to memset(?) in order >> to initialize the buffer array in ata_raid_attach() by removing the >> initializer. There's no memset(?) in the kernel. Instead, assign >> '\0' to the first element. The buffer array holds strings only, so >> this is functionally equivalent. > > Maybe GCC should be taught to generate a bzero call instead? I tend to agree with des@: the compiler should always initialize with inline code. If a call to some initialization function (like memset(3)) is better for the circumstances, the programmer can always remove the initializer on the declaration and call that function explicitly. This leaves the programmer in control, removes questionable dependencies and assumptions and may actually yield better code due to the possibility of exploiting alignment and size knowledge. -- Marcel Moolenaar USPA: A-39004 marcel@xcllnt.net
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ca3b2ad2c8f54a10d44a4ca5512ce778>