From mboxrd@z Thu Jan 1 00:00:00 1970 From: Albert ARIBAUD Date: Mon, 30 Aug 2010 12:46:02 +0200 Subject: [U-Boot] [PATCH] display_buffer: fix misaligned buffer In-Reply-To: <4C7B889B.305@denx.de> References: <1282940584-27957-1-git-send-email-u-boot@emk-elektronik.de> <4C7B7864.2080607@emk-elektronik.de> <4C7B7C52.1040606@emk-elektronik.de> <4C7B889B.305@denx.de> Message-ID: <4C7B8BEA.9080605@free.fr> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Le 30/08/2010 12:31, Stefano Babic a ?crit : > Detlev Zundel wrote: >> Hi Reinhard, >> > Hi Reinhard, hi Detlev, > >>> should make the buffer an union: >>> >>> union { >>> uint32_t ui[MAX.../4+1]; >>> uint16_t us[MAX.../2+1]; >>> uint8_t uc[MAX...+1]; >>> } linebuf; >> >> That also sounds good indeed - it even better documents the intention of >> the code so by my own arguments I'd vote for it. I presume you will >> follow up with such a patch once you tested it? > > I agree this is a better solution as adding a simple comment. Some time > a comment is valid only at the time of the writing, and further patches > could drop its meaning if the comment is not updated, too. Do we have to pick one? I say the code should use union *and* a one-line comment should mention how the union enforces the alignment requirement. Amicalement, -- Albert.