public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: naga raj <gnuuser.raj@gmail.com>
To: Jonathan Wakely <jwakely.gcc@gmail.com>, Andrew Haley <aph@redhat.com>
Cc: gcc-help <gcc-help@gcc.gnu.org>
Subject: Re: libstdc++
Date: Mon, 27 Aug 2012 09:27:00 -0000	[thread overview]
Message-ID: <CAKuVEhDExdpV1q3B7_HveqmZ_Pe60ery71U5GVq+j4_ZmPrUnQ@mail.gmail.com> (raw)
In-Reply-To: <CAH6eHdRpxoPerOwyf0kPhJjCvJDZQqpC7xYCZpu3wj_Va9yjZg@mail.gmail.com>

Hi Jonathan/Andrew

  Thank you very much for your responses.
  I think I have to select a subset of the C++ standard libraries and
implement a smaller library.

Thanks,
Nagaraju



On Fri, Aug 24, 2012 at 3:09 PM, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
> On 24 August 2012 08:46, naga raj wrote:
>> Hi,
>>
>>    I have ported Gcc-4.6.2 to an embedded target. My C++ compiler is
>> generating huge code size.
>>
>>   #include <iostream>
>>  using namespace std;
>>  int main()
>>  {
>>    return 0;
>>  }
>>
>>    If we execute the above program then all the function in the
>> iostream library are included in the elf as a result size of elf is
>> increased....
>
> Including <iostream> causes global objects to be constructed, so even
> though you're not explicitly using std::cout or std::cin, those
> streams are initialized and code is run (before main) just because
> <iostream> is included.  If you don't need to use it then don't
> include it.  If you do need to use it then obviously the code size is
> larger if you use I/O features than if you don't use them.
>
> That said, libstdc++ isn't really optimised for embedded systems.
> Some configure-time options such as building libstdc++ without
> exceptions can help reduce code size, if you don't need to use
> exceptions.
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43852 would also help
> avoid dependency on the I/O facilities.

  reply	other threads:[~2012-08-27  5:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-24  8:10 libstdc++ naga raj
2012-08-24  9:33 ` libstdc++ Andrew Haley
2012-08-24 13:40 ` libstdc++ Jonathan Wakely
2012-08-27  9:27   ` naga raj [this message]
  -- strict thread matches above, loose matches on Subject: below --
1999-11-04 18:42 libstdc++ Inferno
1999-11-07  5:16 ` libstdc++ J.H.M. Dassen (Ray)
1999-11-30 23:28   ` libstdc++ J.H.M. Dassen (Ray)
1999-11-30 23:28 ` libstdc++ Inferno
1999-10-01  0:00 libstdc++ Inferno

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAKuVEhDExdpV1q3B7_HveqmZ_Pe60ery71U5GVq+j4_ZmPrUnQ@mail.gmail.com \
    --to=gnuuser.raj@gmail.com \
    --cc=aph@redhat.com \
    --cc=gcc-help@gcc.gnu.org \
    --cc=jwakely.gcc@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).