Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #3065
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!goblin1!goblin.stu.neva.ru!postnews.google.com!news1.google.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!news.giganews.com.POSTED!not-for-mail |
|---|---|
| NNTP-Posting-Date | Sun, 03 Apr 2011 19:25:46 -0500 |
| From | Pete Becker <pete@versatilecoding.com> |
| Organization | Roundhouse Consulting, Ltd. |
| Newsgroups | comp.lang.c++ |
| Date | Sun, 3 Apr 2011 20:25:47 -0400 |
| Message-ID | <2011040320254756281-pete@versatilecodingcom> (permalink) |
| References | <xhnlp.1597$0j7.632@newsfe20.ams2> <c14c937c-5626-43cc-a0a6-06b743038e49@e21g2000yqe.googlegroups.com> |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=iso-8859-1; format=flowed |
| Content-Transfer-Encoding | 8bit |
| Subject | Re: Compilers way to implement array allocations |
| User-Agent | Unison/2.1.4 |
| Lines | 35 |
| X-Usenet-Provider | http://www.giganews.com |
| X-Trace | sv3-3MK/lRDCVIcsQzDaoUZw3rd0aLZ9/I2135j3WFaWdzqpurVW4sBlu/9Gf+tSUoRCcPb9mOp/5z4BxXI!Rkvnfi0GeZBai2q5O+jy02hzVRGs82JDQosgqEr4MUGwvkQHKgmojKc9dSrJB/QhIeZJxnJu |
| X-Complaints-To | abuse@giganews.com |
| X-DMCA-Notifications | http://www.giganews.com/info/dmca.html |
| X-Abuse-and-DMCA-Info | Please be sure to forward a copy of ALL headers |
| X-Abuse-and-DMCA-Info | Otherwise we will be unable to process your complaint properly |
| X-Postfilter | 1.3.40 |
| X-Original-Bytes | 2210 |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.c++:3065 |
Show key headers only | View raw
On 2011-04-03 13:22:26 -0400, James Kanze said:
> On Apr 3, 6:35 am, Goran <goran.pu...@gmail.com> wrote:
>> On Apr 1, 7:32 pm, "crea" <n...@invalid.com> wrote:
>
> [...]
>>> So my question is, that why cant I destroy this automatic
>>> object? How/why does the compiler prevent that?
>
>> Compiler does not prevent it. For example:
>
>> void f()
>> {
>> int i; // automatic
>> int* p = &i;
>> delete p; // boom
>> }
>
>> This code is 100% legal, and compiler will compile it without any
>> complaint. But at runtime, boom!
>
> The code is not "legal" (for the usual definition of legal). It
> has undefined behavior. One possible behavior is that the
> compiler refuse to compile it, or issues an error message.
> Another is that something strange happens at runtime.
>
And a third is that it will "work just fine". Until it doesn't.
--
Pete
Roundhouse Consulting, Ltd. (www.versatilecoding.com) Author of "The
Standard C++ Library Extensions: a Tutorial and Reference
(www.petebecker.com/tr1book)
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Compilers way to implement array allocations "crea" <no@invalid.com> - 2011-04-01 17:44 +0100
Re: Compilers way to implement array allocations Goran <goran.pusic@gmail.com> - 2011-04-01 10:19 -0700
Re: Compilers way to implement array allocations Victor Bazarov <v.bazarov@comcast.invalid> - 2011-04-01 13:32 -0400
Re: Compilers way to implement array allocations Goran <goran.pusic@gmail.com> - 2011-04-02 22:24 -0700
Re: Compilers way to implement array allocations Virchanza <virtual@lavabit.com> - 2011-04-03 17:49 -0700
Re: Compilers way to implement array allocations "crea" <no@invalid.com> - 2011-04-01 18:32 +0100
Re: Compilers way to implement array allocations Victor Bazarov <v.bazarov@comcast.invalid> - 2011-04-01 13:52 -0400
Re: Compilers way to implement array allocations Paavo Helde <myfirstname@osa.pri.ee> - 2011-04-01 13:29 -0500
Re: Compilers way to implement array allocations "crea" <no@invalid.com> - 2011-04-01 20:10 +0100
Re: Compilers way to implement array allocations Paavo Helde <myfirstname@osa.pri.ee> - 2011-04-01 14:56 -0500
Re: Compilers way to implement array allocations Goran <goran.pusic@gmail.com> - 2011-04-02 22:35 -0700
Re: Compilers way to implement array allocations "crea" <no@invalid.com> - 2011-04-03 14:55 +0100
Re: Compilers way to implement array allocations James Kanze <james.kanze@gmail.com> - 2011-04-03 10:22 -0700
Re: Compilers way to implement array allocations Pete Becker <pete@versatilecoding.com> - 2011-04-03 20:25 -0400
Re: Compilers way to implement array allocations James Kanze <james.kanze@gmail.com> - 2011-04-03 10:15 -0700
csiph-web