From: naveen yadav <yad.naveen@gmail.com>
To: Jonathan Wakely <jwakely.gcc@gmail.com>
Cc: gcc-help <gcc-help@gcc.gnu.org>
Subject: Re: Modification required in cout function
Date: Mon, 09 Jan 2012 12:29:00 -0000 [thread overview]
Message-ID: <CAJ8eaTw7H9bV5Z-L0UJiYFyF02Vt6aKuwUKivfg6vqumZJN5cA@mail.gmail.com> (raw)
In-Reply-To: <CAH6eHdTF8BNy1m3dr8VF=dspdJvE-EC+-Lf1q8N1uYz+D3JNCw@mail.gmail.com>
Thanks a lot Jonathan, it works for me ..
On Sat, Jan 7, 2012 at 5:32 PM, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
> On 7 January 2012 06:49, naveen yadav wrote:
>> Thanks a lot Jonathan,
>>
>> The reason for modifying stdlib is needed because i do not have source
>> code of binary which i want to test.
>> will you pls let me know execty lines in ios_init.cc which I need to
>> modify , this will help me a lot.
>
> Put
> std::cout.setstate(ios_base::failbit);
>
> after cout has been constructed, so around line 102
>
>
>> Thanks
>>
>> On Fri, Jan 6, 2012 at 6:25 PM, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
>>> On 6 January 2012 12:41, naveen yadav wrote:
>>>> The reason is that is we want to check effect of cout on application booting.
>>>> Below is simple hello world program, It still call write() system
>>>> call. This may delay if
>>>> we have lots of cout in applications.
>>>> so we want that cout simply return without call of write().
>>>
>>> std::cout.setstate(ios_base::failbit);
>>>
>>> If you do that at the top of main() it will prevent any writes to
>>> cout. If your library writes to cout before main() starts, you could
>>> put that in a global object's constructor (and use
>>> __attribute__((init_priority(101))) to make it run before other global
>>> constructors)
>>>
>>> Or if you really insist on modifying the stdlib, do that in
>>> ios_init.cc in ios_base::Init::Init() (not in sync_with_stdio, that's
>>> the wrong place)
prev parent reply other threads:[~2012-01-09 11:17 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-06 9:28 naveen yadav
2012-01-06 9:46 ` naveen yadav
2012-01-06 9:46 ` Jonathan Wakely
2012-01-06 9:48 ` Jonathan Wakely
2012-01-06 12:41 ` naveen yadav
2012-01-06 12:41 ` Jonathan Wakely
2012-01-06 12:55 ` naveen yadav
2012-01-06 14:51 ` Jonathan Wakely
2012-01-07 12:02 ` naveen yadav
2012-01-07 17:32 ` Jonathan Wakely
2012-01-09 12:29 ` naveen yadav [this message]
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=CAJ8eaTw7H9bV5Z-L0UJiYFyF02Vt6aKuwUKivfg6vqumZJN5cA@mail.gmail.com \
--to=yad.naveen@gmail.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).