Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!mcgill-vision!snorkelwacker!apple!portal!cup.portal.com!Daniel_Gregory_Corbett From: Daniel_Gregory_Corbett@cup.portal.com Newsgroups: comp.lang.c++ Subject: Re: #defines.... Message-ID: <31369@cup.portal.com> Date: 3 Jul 90 04:17:35 GMT References: <37786@genrad.UUCP> Organization: The Portal System (TM) Lines: 25 Stephen Peters asks: >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... If you wish to use conditional compilation using #ifdef, and the like then #defines are required. const variables are not understood by cpp and are therefore ignored. Example: #define DEBUG /* This might be defined on the command line */ /* using -DDEBUG */ #ifdef DEBUG printf("Debug Statement i=%d\n", i); #endifk - Daniel