From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lothar =?UTF-8?B?V2HDn21hbm4=?= Date: Wed, 21 Jun 2017 09:59:05 +0200 Subject: [U-Boot] [PATCH] dm: video: fix abuse of enum In-Reply-To: References: <1497954329-13384-1-git-send-email-LW@KARO-electronics.de> Message-ID: <20170621095905.0fa0fb0c@karo-electronics.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit To: u-boot@lists.denx.de Hi, On Tue, 20 Jun 2017 12:26:29 -0600 Simon Glass wrote: > Hi Lothar, > > On 20 June 2017 at 04:25, Lothar Waßmann wrote: > > LCD_MAX_WIDTH, LCD_MAX_HEIGHT and LCD_MAX_LSBPP are not alternative > > values for one specific variable, but unrelated entities with distinct > > purposes. There is no use defining them as values of an 'enum'. > > Can you explain why #define is better? I prefer enum since they are a > compiler construct instead of preprocessor (thus no need for brackets, > no strange conversion things) and the debugger knows about them. > An enum defines alternative values for one specific entity (e.g. clauses for a switch construct), but not a collection of arbitrary data items. > > The 'enum' construct would fail miserably for an LCD controller that > > has a square max. frame size (e.g. 4096x4096). > > What does this mean? I don't understand sorry. > Try your enum with MAX_LCD_WITDH == MAC_LCD_HEIGHT. Lothar Waßmann