From: Reinhard Meyer Date: Wed, 08 Sep 2010 10:04:37 +0200 Subject: [U-Boot] [PATCH v2] display_buffer: fix misaligned buffer In-Reply-To: <20100908074857.B81BF153798@gemini.denx.de> References: <1283243000-25427-1-git-send-email-u-boot@emk-elektronik.de> <20100907233338.CE0A31506AA@gemini.denx.de> <4C87065A.5050904@emk-elektronik.de> <20100908074857.B81BF153798@gemini.denx.de> Message-ID: <4C874395.6060406@emk-elektronik.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 08.09.2010 09:48, Wolfgang Denk wrote: > Dear Reinhard Meyer, > > In message<4C87065A.5050904@emk-elektronik.de> you wrote: >> Dear Wolfgang Denk, >>>> + /* linebuf as a union causes proper alignment */ >>>> + union linebuf { >>>> + uint32_t ui[MAX_LINE_LENGTH_BYTES/4 + 1]; >>>> + uint16_t us[MAX_LINE_LENGTH_BYTES/2 + 1]; >>>> + uint8_t uc[MAX_LINE_LENGTH_BYTES/1 + 1]; >>> >>> Please replace the magic numbers 4, 2 and 1 by respective sizeof(). >> >> >> AND >> >> >> > Please let's use the attribute version. >> >> Which shall it be now??? > > Well, my personal preference would be to use "attribute", but after > the long discussion it seems the general preference is the version > above so I will not block this. I just ask to change the "magic > numbers" 1, 2 and 4 into sizeof() so it's obvious where these are > coming from. OK, I will change that, even add the {} at the for() loop. I am working with too many (non-gnu) C compilers and have seen too many ways for "attribute", "#pragma", etc. So I prefer to do things within the standard "C" language ;) Reinhard