Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Ian Collins <ian-news@hotmail.com> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: Design decisions |
| Date | 2012-06-23 21:52 +1200 |
| Message-ID | <a4lhv0Fe9mU1@mid.individual.net> (permalink) |
| References | (9 earlier) <js2pp5$t7c$1@speranza.aioe.org> <a4k9f8FglmU2@mid.individual.net> <js31mt$dci$1@speranza.aioe.org> <a4kinoFglmU3@mid.individual.net> <js40oi$9lc$1@speranza.aioe.org> |
On 06/23/12 09:03 PM, jacob navia wrote:
> Le 23/06/12 02:59, Ian Collins a écrit :
>> On 06/23/12 12:13 PM, jacob navia wrote:
>
>>> Yes. Up to 30% or more of space are now taken by tables describing the
>>> stack movements to the unwinding virtual machine that the C++ run time
>>> needs.
>>
>> Now where did you dig up that "fact" from? Automatic destruction works
>> perfectly well without run time support.
>
> Confirmed. Most C++ programmers have no idea of what is needed behind
> the scene to make all those nice syntax constructs work.
Confirmed, you are talking out of the wrong end again.
> AUTOMATIC DESTRUCTION MUST WORK IN THE CASE OF A THROW.
Not if you turn exceptions off, which is a better comparison in this
case (C++ as a better C). I use C++ (mainly to get automatic resource
management) in driver and kernel module code where there isn't any run
time support, so I most certainly do know what goes on behind the scenes.
For example, the following
extern "C" int* get();
extern "C" void done(int*);
extern "C" void process(int*);
struct Manage {
int* n;
Manage( int* n ) : n(n) {}
~Manage() {done(n);}
};
void f() {
int* n = get();
Manage m(n);
process(n);
}
Compiles (with g++ -S -O3 -fno-exceptions) to:
.file "z.cc"
.text
.p2align 4,,15
.globl _Z1fv
.type _Z1fv, @function
_Z1fv:
pushl %ebp
movl %esp, %ebp
pushl %ebx
subl $20, %esp
call get
movl %eax, %ebx
movl %eax, (%esp)
call process
movl %ebx, (%esp)
call done
addl $20, %esp
popl %ebx
popl %ebp
ret
.size _Z1fv, .-_Z1fv
.ident "GCC: (GNU) 4.5.2"
Which is probably tighter than any manual stack pushing and popping.
--
Ian Collins
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Design decisions jacob navia <jacob@spamsink.net> - 2012-06-21 22:19 +0200
Re: Design decisions Andrew Cooper <amc96@cam.ac.uk> - 2012-06-21 21:43 +0100
Re: Design decisions "BartC" <bc@freeuk.com> - 2012-06-21 22:02 +0100
Re: Design decisions Gareth Owen <gwowen@gmail.com> - 2012-06-21 23:23 +0100
Re: Design decisions jacob navia <jacob@spamsink.net> - 2012-06-22 09:12 +0200
Re: Design decisions Ian Collins <ian-news@hotmail.com> - 2012-06-22 19:44 +1200
Re: Design decisions "Joe." <antelope3@news.net> - 2012-06-25 00:32 -0600
Re: Design decisions gwowen <gwowen@gmail.com> - 2012-06-22 01:00 -0700
Re: Design decisions jacob navia <jacob@spamsink.net> - 2012-06-22 10:08 +0200
Re: Design decisions Gareth Owen <gwowen@gmail.com> - 2012-06-22 17:18 +0100
Re: Design decisions jacob navia <jacob@spamsink.net> - 2012-06-22 18:27 +0200
Re: Design decisions Ian Collins <ian-news@hotmail.com> - 2012-06-23 08:44 +1200
Re: Design decisions jacob navia <jacob@spamsink.net> - 2012-06-22 23:58 +0200
Re: Design decisions Ian Collins <ian-news@hotmail.com> - 2012-06-23 10:21 +1200
Re: Design decisions jacob navia <jacob@spamsink.net> - 2012-06-23 02:13 +0200
Re: Design decisions Ian Collins <ian-news@hotmail.com> - 2012-06-23 12:59 +1200
Re: Design decisions jacob navia <jacob@spamsink.net> - 2012-06-23 11:03 +0200
Re: Design decisions Ian Collins <ian-news@hotmail.com> - 2012-06-23 21:52 +1200
Re: Design decisions jacob navia <jacob@spamsink.net> - 2012-06-23 12:32 +0200
Re: Design decisions Gareth Owen <gwowen@gmail.com> - 2012-06-23 13:54 +0100
Re: Design decisions "Joe." <antelope3@news.net> - 2012-06-25 00:36 -0600
Re: Design decisions jacob navia <jacob@spamsink.net> - 2012-06-22 10:42 +0200
Re: Design decisions Gareth Owen <gwowen@gmail.com> - 2012-06-22 17:18 +0100
Re: Design decisions jacob navia <jacob@spamsink.net> - 2012-06-24 18:32 +0200
Re: Design decisions James Kuyper <jameskuyper@verizon.net> - 2012-06-21 18:43 -0400
Re: Design decisions "Joe." <antelope3@news.net> - 2012-06-25 00:40 -0600
Re: Design decisions "Joe." <antelope3@news.net> - 2012-06-25 00:28 -0600
Re: Design decisions "io_x" <a@b.c.invalid> - 2012-06-22 08:35 +0200
Re: Design decisions Neil Cerutti <neilc@norwich.edu> - 2012-06-22 12:40 +0000
Re: Design decisions gwowen <gwowen@gmail.com> - 2012-06-22 06:01 -0700
Re: Design decisions Neil Cerutti <neilc@norwich.edu> - 2012-06-22 14:26 +0000
Re: Design decisions Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-06-22 14:01 +0100
Re: Design decisions David Resnick <lndresnick@gmail.com> - 2012-06-22 06:13 -0700
Re: Design decisions Jens Gustedt <jens.gustedt@loria.fr> - 2012-06-22 19:05 +0200
Re: Design decisions "Joe." <antelope3@news.net> - 2012-06-25 00:27 -0600
csiph-web