Re: Modification required in cout function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx> 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)



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux