From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,703c4f68db81387d X-Google-Thread: 109fba,703c4f68db81387d X-Google-Thread: 115aec,703c4f68db81387d X-Google-Thread: f43e6,703c4f68db81387d X-Google-Attributes: gid103376,gid109fba,gid115aec,gidf43e6,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!news.glorb.com!wn14feed!worldnet.att.net!bgtnsc05-news.ops.worldnet.att.net.POSTED!53ab2750!not-for-mail Newsgroups: comp.lang.ada,comp.lang.c++,comp.realtime,comp.software-eng Subject: Re: Teaching new tricks to an old dog (C++ -->Ada) From: Jim Rogers References: <4229bad9$0$1019$afc38c87@news.optusnet.com.au> <1111607633.301232.62490@z14g2000cwz.googlegroups.com> <1111619568.938415.90010@g14g2000cwa.googlegroups.com> Followup-To: comp.lang.ada,comp.lang.c++ User-Agent: Xnews/5.04.25 Message-ID: Date: Thu, 24 Mar 2005 02:42:51 GMT NNTP-Posting-Host: 12.73.181.213 X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc05-news.ops.worldnet.att.net 1111632171 12.73.181.213 (Thu, 24 Mar 2005 02:42:51 GMT) NNTP-Posting-Date: Thu, 24 Mar 2005 02:42:51 GMT Organization: AT&T Worldnet Xref: g2news1.google.com comp.lang.ada:9873 comp.lang.c++:46974 comp.realtime:1660 comp.software-eng:5265 Date: 2005-03-24T02:42:51+00:00 List-Id: "Jerry Coffin" wrote in news:1111619568.938415.90010 @g14g2000cwa.googlegroups.com: > > Regardless of the wording, however, I think this is (mostly) a > red-herring. What do you consider unsafe about (for example) some chunk > of code being compiled only when I want it to be? If I really believe > in the compiler's optimizer, I can already do things like "if False" in > Ada, and that code clearly won't ever execute. It just happens that C > and C++ provide a simple and practical method of doing the same things > in a way that's easy to externally control. The kinds of things that were considered unsafe with a pre-processor are those things that are not type-safe. These problems sometimes arise in the use of macros. For instance the following macro can cause some serious problems when mis-applied: #define SWAP(A,B) ((temp) = (A);(A) = (B); (B) = (temp)) char s1[30]; int i; SWAP(S1, i); In many cases it is safer to define an in-line function than to define a macro. Jim Rogers