lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: lynx-dev Saner mouse in lynx with ncurses


From: Mike Castle
Subject: Re: lynx-dev Saner mouse in lynx with ncurses
Date: Wed, 25 Nov 1998 23:12:16 -0600 (CST)

Amazingly enough address@hidden said:
> > Just as a matter of programming style, would this not be better implemented 
> > as an enum? 
> 
> maybe/maybe not - storing enum values as int's doesn't always work well
> on older compilers (which Lynx builds on).  If I saw it as an enum, I'd
> have to take that into consideration.

What storage is being done here?

If storing items, I would stay with defines, but for internal use, I would
think that enums provide a better style.

Granted, compilers don't enforce type checking on them, but, if a function
says it takes something of a certain type, or a switch statement is done
against a veriable of a certain type, then it's easier for the programmer
to remember what's going on.

Plus, just plain saving having to manually give the defines different,
monotonically increasing values.  And it just plain looks better, in my
opinion.


#define REMOVE_KEY       269     /* 0x10D */ 
#define MOUSE_KEY        270     /* 0x10E */ 
#define DO_NOTHING       271     /* 0x10F */ 

vs..

typedef enum
{
  REMOVE_KEY = 269,
  MOUSE_KEY,
  DO_NOTHING
} event_type;


Of course, in a larger setting, the differences are much more striking.

mrc
-- 
       Mike Castle       Life is like a clock:  You can work constantly
  address@hidden  and be right all the time, or not work at all
www.netcom.com/~dalgoda/ and be right at least twice a day.  -- mrc
    We are all of us living in the shadow of Manhattan.  -- Watchmen

reply via email to

[Prev in Thread] Current Thread [Next in Thread]