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.3 required=5.0 tests=BAYES_00,HEADER_SPAM autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,b30bd69fa8f63cb2 X-Google-Attributes: gid103376,public X-Google-Thread: fc772,b30bd69fa8f63cb2 X-Google-Attributes: gidfc772,public X-Google-ArrivalTime: 2003-06-14 02:54:37 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!nntp.cs.ubc.ca!nntp-relay.ihug.net!ihug.co.nz!news-out.newsfeeds.com!propagator2-maxim!news-in-maxim.spamkiller.net!usc.edu!rpi!not-for-mail From: LLeweLLyn Newsgroups: comp.lang.ada,comp.lang.c++.moderated Subject: Re: C bug of the day Date: 14 Jun 2003 05:56:50 -0400 Organization: The Illusory Sorting Algorithm Sender: cppmods@netlab.cs.rpi.edu Message-ID: References: <1054751321.434656@master.nyc.kbcfp.com> NNTP-Posting-Host: netlab.cs.rpi.edu X-Original-Date: Fri, 13 Jun 2003 10:23:37 -0600 X-Submission-Address: c++-submit@netlab.cs.rpi.edu X-Auth: PGPMoose V1.1 PGP comp.lang.c++.moderated iQBVAwUAPurxXkHMCo9UcraBAQGtLQH/TNV+uxiV0I40XT9TS6hkN8gX/p3XMefC prDOcVLKZmd8+2SvC3tZR3UpJVLkf0SMtUM9LSgaasfpw4TMHCungA== =K6Kh Xref: archiver1.google.com comp.lang.ada:39162 comp.lang.c++.moderated:68333 Date: 2003-06-14T05:56:50-04:00 List-Id: Wesley Groleau writes: > > > > One point where I'm pretty sure Ada 83 didn't have the right default > > (although they may have fixed it in Ada 95): garbage collection. While > > there are places where it is necessary to turn garbage collection off > > (which seriously limits the use of a language in which you cannot have > > untraced pointers, which the garbage collector cannot see), the safe > > option is obviously to have it on by default, no? > > In Ada, GC is automatic for stack variables, [snip] In C++ GC is automatic for stack variables as well - and via constructors and destructors, one can leverage that to make it automatic for many kinds of dynamic variables. This isn't a complete solution however - one sometimes ends up with a few dynamic objects for which no readlily availible smart pointer is suitable. > but it > was intentionally left up to the vendor for access types > (which in Ada only exist when the programmer explicitly > declares them) because in some applications, it could > cause timing problems. However, Ada 95 did add the ability > for the programmer to define whether GC occurs for any particular > data type, as well as to define how it occurs. What do you mean by 'define how it occurs'? In C++ one 'defines how it occurs' by overloading new and delete, writing a smart pointer, or downloading an appropriate smart pointer or garbage collector. This is hardly the most convient way (for a programmer using C++), but it has oodles of flexibility. > > > 2) you can generally "work around" the safety checks if necessary > > (hopefully on a case by case basis, using source code constructs; > > e.g. by writing array.unsafe_at( index ) rather than array[ index ]). > > Actually, it's something like > pragma Suppress ( , ); [snip] I think in another post I provided a link to what the rm95 has to say about this. [ Send an empty e-mail to c++-help@netlab.cs.rpi.edu for info ] [ about comp.lang.c++.moderated. First time posters: do this! ]