|
Boost : |
Subject: Re: [boost] [context] Linux x64 / printf
From: Oliver Kowalke (oliver.kowalke_at_[hidden])
Date: 2012-09-11 12:56:00
Am 11.09.2012 18:14, schrieb Daniel Larimer:
> On Tue, Sep 11, 2012 at 1:57 AM, Pekka Seppänen <
> pekka.seppanen_at_[hidden]> wrote:
>
>> On 11.9.2012 5:00, Daniel Larimer wrote:
>>> I modified the 'jump.cpp' example and added the line marked CRASH in f1()
>>>
>>> #include <cstdlib>
>>> #include <cstring>
>>> #include <iostream>
>>> #include <vector>
>>>
>> ...
>>
>>> void f1( intptr_t)
>>> {
>>> std::cout<<"hello "<<0; // WORKS
>>> printf( "hello %d", 0 ); // <<< CRASH
>>> std::cout << "f1: entered" << std::endl;
>>> std::cout << "f1: call jump_fcontext( & fc1, & fc2, 0)" <<
>> std::endl;
>>> ctx::jump_fcontext( & fc1, & fc2, 0);
>>> std::cout << "f1: return" << std::endl;
>>> ctx::jump_fcontext( & fc1, & fcm, 0);
>>> }
>> I guess printf should be pulled from cstdio (not that you should use it,
>> printf that is, in the first place), so perhaps your compiler is using some
>> short of build-in instead which causes the crash.
>>
> I am just using the standard compiler... the reason I was using printf()
> is because I wanted to avoid including all of iostream in every build...
> accelerate compile times.
>
> Fortunately, I wrap all of my console prints in a debug macro that made
> it easy for me to switch to iostream at the expense of doubling my compile
> times.
>
> If it were simply a 'stack size' issue then it still wouldn't solve my
> problem because I really to do want the minimum stack size as I have a lot
> of async operations where the state is managed on the 'stack'.
>
>
your app does not crash (cstdio must be included) on my x86_64 Linux system
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk