public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: "Lothar Waßmann" <LW@KARO-electronics.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] dm: video: fix abuse of enum
Date: Wed, 21 Jun 2017 09:59:05 +0200	[thread overview]
Message-ID: <20170621095905.0fa0fb0c@karo-electronics.de> (raw)
In-Reply-To: <CAPnjgZ3VCcNpP_Ww1OiZL9zn312JN62JWZVqCwuFk9HWo3u5rQ@mail.gmail.com>

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 <LW@karo-electronics.de> 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

  reply	other threads:[~2017-06-21  7:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-20 10:25 [U-Boot] [PATCH] dm: video: fix abuse of enum Lothar Waßmann
2017-06-20 18:26 ` Simon Glass
2017-06-21  7:59   ` Lothar Waßmann [this message]
2017-06-23  6:30     ` Lothar Waßmann
2017-07-06  4:49       ` Simon Glass
2017-07-06  7:50         ` Lothar Waßmann
2017-07-06 12:22           ` Marcel Ziswiler
2017-07-07  6:41             ` Lothar Waßmann
2017-07-14 13:47               ` Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170621095905.0fa0fb0c@karo-electronics.de \
    --to=lw@karo-electronics.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox