幻想完美主义

导航

OTR-记一个关于参数传递的问题.

What I write, what I lost.

#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#include <libio.h>
#include <unistd.h>
#include <math.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
//#include <sys/time.h>
#include <pthread.h>




int test();

int main()
{
    test();
    printf("\n");
    test();
    printf("\n");

    return 0;
}


int test()
{
    struct timeval tmp_t;
    gettimeofday(&tmp_t);
    int ret = tmp_t.tv_sec;
    return ret;
}

编译的时候忽略警告.
执行发现程序会不能正常退出.
这个可能跟gettimeofday的第二个参数相关. 解释不能.

谢谢.

posted on 2012-06-11 18:37  幻想完美主义  阅读(243)  评论(0编辑  收藏  举报