Path: utzoo!utgpu!watserv1!watmath!att!rutgers!usc!samsung!uunet!dlogics!dsa From: dsa@dlogics.COM (David Angulo) Newsgroups: comp.lang.c++ Subject: Re: #defines.... Summary: Another use for #define Message-ID: <605@dlogics.COM> Date: 16 Jul 90 22:35:35 GMT References: <37786@genrad.UUCP> <172@logo.procase.UUCP> Organization: Datalogics Inc., Chicago Lines: 38 > In article <37786@genrad.UUCP> slp@genrad.genrad.COM (Steven L. Peters) writes: > >Just out of curiousity... > > > >With the C++ const, enum, and inline declarations, is it ever > >necessary to use #define in a C++ program? Stroustrup emphatically > >says in _The C++ Programming Language_ not to use them if you don't > >have to. I'm wondering if you ever have to. I can't think of a > >single time where you would be forced to use a #define over const or > >inline... > > Another example: use it for compiler directives. For example the #include can be commented out like thus: Module a: #ifndef a #define a ... // rest of module a ... #endif module b: #ifndef a #include "a.h" #endif ... // rest of module b -- David S. Angulo (312) 266-3134 Datalogics Internet: dsa@dlogics.com 441 W. Huron UUCP: ..!uunet!dlogics!dsa Chicago, Il. 60610 FAX: (312) 266-4473