const vs. #define
Ed McNierney
ed at TOPOZONE.COM
Thu Oct 19 11:37:22 EDT 2006
Tom -
I'm not aware of any "rules", and I haven't heard general philosophy
about which is preferred. However, from a usage and readability point
of view, my personal preference is to use const for a value that is a
true constant, while I use #define for a value that is defined to be
such at the moment but which may change. PI is a constant, but
MAX_LAYERS is not. I can't imagine it makes any detectable difference
in the generated code.
- Ed
Ed McNierney
President and Chief Mapmaker
TopoZone.com / Maps a la carte, Inc.
73 Princeton Street, Suite 305
North Chelmsford, MA 01863
ed at topozone.com
(978) 251-4242
-----Original Message-----
From: UMN MapServer Developers List [mailto:MAPSERVER-DEV at LISTS.UMN.EDU]
On Behalf Of Kralidis,Tom [Burlington]
Sent: Thursday, October 19, 2006 9:05 AM
To: MAPSERVER-DEV at LISTS.UMN.EDU
Subject: [UMN_MAPSERVER-DEV] const vs. #define
Hi,
Are there any rules on using const vs. #define in MapServer source code?
I've often heard const is preferred, but is also relatively new.
Just wondering...
..Tom
More information about the mapserver-dev
mailing list