2013년 5월 22일 수요일

#if 1 #else #endif 를 이용하여 주석처리

#if 1 #else #endif 를 이용하여 주석처리


#if 1 /* new */
    rtn = Popen(command_path,"w", &status);
    if(rtn != 0)
    {
        memset(temp, 0, SIZE_32);
        sprintf(temp,"/tmp/%s",job_name);
        unlink(temp);
#ifdef DEBUG
PRINT(LOG_PRINTE, MSQ_CLI, -1)("there is not /user/bin/wrapper/scheduler_wrapper\n");
#endif
        return ABORT_FAILED;
    }

#else /* old */

    fd = popen(command_path,"w");
    i = pclose(fd);
    i = i >> 8;
#ifdef DEBUG
PRINT(LOG_PRINTE, MSQ_CLI, -1)("return value : %d\n",i);
#endif
    if(i == 127)
    {
        memset(temp, 0, SIZE_32);
        sprintf(temp,"/tmp/%s",job_name);
        unlink(temp);
#ifdef DEBUG
PRINT(LOG_PRINTE, MSQ_CLI, -1)("there is not /user/bin/wrapper/scheduler_wrapper\n");
#endif
        return ABORT_FAILED;
    }
#endif /* end */

* old 부분은 컴파일이 되지 않는다...
이것을 이용하면...프로그램밍 할때....예전것을 지우지 않고 할수 가 있따....
old 부분을 살리고 new를 주석 처리 하고 싶으면...
#if 1 이 부분을 0으로 하면 new가 주석처리 효과를 가지고 올수 있다...
프로그래밍 하기가 점점 쉬워지고 있는것 같다..ㅋㅋㅋ

댓글 없음:

댓글 쓰기