TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: PAUL WANKADIA
from: THOMAS MAEDER
date: 1997-07-09 19:56:00
subject: First C++ prog

PW>  TM> Better replace your #defines with enums.
PW> Why's that?
Because #defines don't only define constants but change the language.
Using enums, you can define constants without changing the language.
enum { myconstant = 42 };
and
#define myconstant 42
both  define  the  same  constant. The enum way allows you to nest the
constant into a class or namespace to prevent the  global  name  space
from being polluted.
The  only  usage  of  #define that I consider to be good style is when
it's used to prevent a header file from being included more than  once
per compilation unit.
Thomas
---
 þ MM 1.0 #0113 þ My toughest fight was with my first wife. - Ali
---------------
* Origin: McMeier & Son BBS (2:301/138)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.