Boost logo

Boost :

Subject: Re: [boost] [context] Linux x64 / printf
From: Pekka Seppänen (pekka.seppanen_at_[hidden])
Date: 2012-09-11 01:57:18


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.

-- Pekka


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk