This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Modification required in cout function


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.

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)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]