aprovy / spserver

Automatically exported from code.google.com/p/spserver
Other
0 stars 0 forks source link

compile bug #6

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
gcc -Wall -D_REENTRANT -D_GNU_SOURCE -g -fPIC -I/usr/local/include/ -c
testthreadpool.cpp -o testthreadpool.o
testthreadpool.cpp: In function ¡®void threadFunc(void*)¡¯:
testthreadpool.cpp:21: 错误从'void *' 到 ' int' 的转换损失精度
make: *** [testthreadpool.o] ´íÎó 1

Original issue reported on code.google.com by chenh...@gmail.com on 12 Dec 2008 at 9:17

GoogleCodeExporter commented 8 years ago
之前在 x86_64 平台上编译的时候,有过类似的错误。
不知道是不是在 64 位平台上编译呢?

Original comment by stephen....@gmail.com on 13 Dec 2008 at 4:06

GoogleCodeExporter commented 8 years ago
testthreadpool.cpp中的
void threadFunc( void *arg )
{
    int seconds = (int) arg;

    fprintf( stdout, "  in threadFunc %d\n", seconds );
    fprintf( stdout, "  thread#%ld\n", sp_thread_self() );
    sleep( seconds );
    fprintf( stdout, "  done threadFunc %d\n", seconds);
}

改成
void threadFunc( void *arg )
{
    int seconds = * (int *) arg;

    fprintf( stdout, "  in threadFunc %d\n", seconds );
    fprintf( stdout, "  thread#%ld\n", sp_thread_self() );
    sleep( seconds );
    fprintf( stdout, "  done threadFunc %d\n", seconds);
}

Original comment by dodo.w...@gmail.com on 30 Jul 2011 at 2:25

GoogleCodeExporter commented 8 years ago
楼上的建议很给你啊!

Original comment by zhouqian...@gmail.com on 20 Dec 2011 at 8:52