Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #97277

Re: Negative effects of c++ in C

From Ben Bacarisse <ben.usenet@bsb.me.uk>
Newsgroups comp.lang.c
Subject Re: Negative effects of c++ in C
Date 2016-11-22 15:55 +0000
Organization A noiseless patient Spider
Message-ID <87eg23y0ea.fsf@bsb.me.uk> (permalink)
References <o1160t$a5q$1@dont-email.me> <87r363y4dh.fsf@bsb.me.uk> <o11md9$4jd$1@dont-email.me>

Show all headers | View raw


David Brown <david.brown@hesbynett.no> writes:

> On 22/11/16 15:29, Ben Bacarisse wrote:
>> jacobnavia <jacob@jacob.remcomp.fr> writes:
>> 
>>> Since most C compilers are just c++ compilers that also compile C,
>>> they generate all the tables needed for exception handling even if the
>>> file is a C file. For instance in a moderately sized program (1.5MB)
>>> fully
>>> approx 100 000 bytes are just exception handling tables needed for c++
>>> even if the program is C only!
>> 
>> That's not good.  What ones?  I don't recall ever seeing thing problem
>> with a C compiler before, but I don't have access to most C
>> compilers.

(I see from elsewhere it's gcc so I could have seen the problem if I'd
looked.)

> You only see it on x86-64, and that is because it is a requirement of
> the ABI.

Ah, thank.  I've obviously not been paying attention since I got an
x86-64 system.

> You can minimise the tables by using the -fno-unwind-tables
> -fno-asynchronous-unwind-tables flags.  The code will work fine, as long
> as you are not debugging.

If you pass -g, I think those flags also work when debugging as the
tables are then written into special debug sections.  (This is just from
a bit of searching done since the issue came up so take with a pinch of
salt.)

> And on *nix it rarely matters that there is extra data like this in an
> executable file - those parts are typically not read in from files, so
> they take no memory at run-time.

And it seems you can save the file space by stripping them out
post-compile if you like (strip -R).  Again, not sure how reliable that
information is but I tried it on a few programs with no ill-effects.

It would appear not to be a very strong requirement of the ABI.

-- 
Ben.

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Negative effects of c++ in C jacobnavia <jacob@jacob.remcomp.fr> - 2016-11-22 11:18 +0100
  Re: Negative effects of c++ in C Noob <root@127.0.0.1> - 2016-11-22 11:46 +0100
    Re: Negative effects of c++ in C jacobnavia <jacob@jacob.remcomp.fr> - 2016-11-22 14:48 +0100
      Re: Big main() "Mr. Man-wai Chang" <toylet.toylet@gmail.com> - 2016-11-22 21:51 +0800
      Re: Negative effects of c++ in C Noob <root@127.0.0.1> - 2016-11-22 15:29 +0100
      Re: Negative effects of c++ in C antispam@math.uni.wroc.pl - 2016-11-22 15:09 +0000
    Re: Negative effects of c++ in C jacobnavia <jacob@jacob.remcomp.fr> - 2016-11-22 16:58 +0100
  Re: Negative effects of c++ in C Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-11-22 14:29 +0000
    Re: Negative effects of c++ in C David Brown <david.brown@hesbynett.no> - 2016-11-22 15:58 +0100
      Re: Negative effects of c++ in C Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-11-22 15:55 +0000
      Re: Negative effects of c++ in C jacobnavia <jacob@jacob.remcomp.fr> - 2016-11-22 17:01 +0100
        Re: Negative effects of c++ in C Noob <root@127.0.0.1> - 2016-11-22 18:32 +0100
        Re: Negative effects of c++ in C David Brown <david.brown@hesbynett.no> - 2016-11-23 00:19 +0100
  [OT] It's only words... :) "Mr. Man-wai Chang" <toylet.toylet@gmail.com> - 2016-11-22 22:55 +0800
    Re: [OT] It's only words... :) "Mr. Man-wai Chang" <toylet.toylet@gmail.com> - 2016-11-22 22:57 +0800
  Re: Negative effects of c++ in C Ian Collins <ian-news@hotmail.com> - 2016-11-23 08:43 +1300
    Re: Negative effects of c++ in C jacobnavia <jacob@jacob.remcomp.fr> - 2016-11-22 21:14 +0100
    Re: Negative effects of c++ in C jacobnavia <jacob@jacob.remcomp.fr> - 2016-11-22 21:17 +0100
  Re: Negative effects of c++ in C rockbrentwood@gmail.com - 2016-11-23 15:41 -0800
    Re: Negative effects of c++ in C supercat@casperkitty.com - 2016-11-23 16:19 -0800
      Re: Negative effects of c++ in C David Brown <david.brown@hesbynett.no> - 2016-11-24 14:06 +0100
        Re: Negative effects of c++ in C supercat@casperkitty.com - 2016-11-24 07:36 -0800
          Re: Negative effects of c++ in C David Brown <david.brown@hesbynett.no> - 2016-11-25 00:23 +0100
            Re: Negative effects of c++ in C supercat@casperkitty.com - 2016-11-25 09:42 -0800
    Re: Negative effects of c++ in C Keith Thompson <kst-u@mib.org> - 2016-11-23 16:34 -0800
      Re: Negative effects of c++ in C David Brown <david.brown@hesbynett.no> - 2016-11-24 14:55 +0100

csiph-web