Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!ucbvax!ALTAR.EE.BYU.EDU!jlol From: jlol@ALTAR.EE.BYU.EDU (Jay Lawlor) Newsgroups: comp.lang.c++ Subject: Re: #defines.... Message-ID: <9007062136.AA08003@ucbvax.Berkeley.EDU> Date: 6 Jul 90 21:37:14 GMT Sender: daemon@ucbvax.BERKELEY.EDU Reply-To: jlol@altar.ee.byu.edu Lines: 21 > 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... What about something like this? #define QUIT(err) { do_some_cleanup_stuff(); return(err); } With a macro, the return(err) returns from the function that invoked QUIT, but with an inline function you can only "return" back to the invoking function, right? Not that you couldn't return some other way, but I just thought of this when I was reading some code that used a similar #define. Jay