원문 출처 : http://www.openoffice.org/servlets/ReadMsg?msgId=930121&listName=dev


제목 [dev] A Static Assert implementation
표준 보기 메시지 원본 데이터 출력
Date: Tue, 11 Nov 2003 12:10:11 +0000
From: Caolan McNamara <Caolan.McNamara@Sun.COM>
Content-type: text/plain
Subject: [dev] A Static Assert implementation

We've a number of assert macros which could more profitably be picked up during compile time rather than at run time. Here's an implementation of a staticassert that I've been using successfully in the ww8 filter implemented as sw/source/filter/ww8/inc/staticassert.hxx for some time. An example usage is

StaticAssert((sizeof(stiName) / sizeof(stiName[0])) == 77,
    WrongSizeOfArray);
The constraints are that the error message is a plausible class name, i.e. no spaces and that the test can be done at compile time, e.g. array size checking etc. Perhaps this would be useful moved elsewhere as an office wide construct, instead of just for the ww8 filter.

/*
 Lifted direct from:
 Modern C++ Design: Generic Programming and Design Patterns Applied
 Section 2.1
 by Andrei Alexandrescu
*/
namespace ww
{
    template<bool> class compile_time_check
    {
    public:
        compile_time_check(...) {}
    };

    template<> class compile_time_check<false>
    {
    };
}

    /*
    Similiar to assert, StaticAssert is only in operation when NDEBUG
    is not defined. It will test its first argument at compile time 
    and on failure report the error message of the second argument,
    which must be a valid c++ classname. i.e. no spaces, punctuation 
    or reserved keywords.
    */
#ifndef NDEBUG
#   define StaticAssert(test, errormsg)                         \
    do {                                                        \
        struct ERROR_##errormsg {};                             \
        typedef ww::compile_time_check< (test) != 0 > tmplimpl; \
        tmplimpl aTemp = tmplimpl(ERROR_##errormsg());          \
        sizeof(aTemp);                                          \
    } while (0)
#else
#   define StaticAssert(test, errormsg)                         \
    do {} while (0)
#endif

C.
-- 
Caolan McNamara <Caolan.McNamara@Sun.COM>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@openoffice.org
For additional commands, e-mail: dev-help@openoffice.org

http://www.microquill.com/index.html

SMP 환경에서 성능 좋은 Heap이라고 합니다.

회사 동료인 redscorpion님께서 추천해준 싸이트.. ㅎㅎ

근데.. 모.. 저는 아직 SMP 환경에서 개발 할 일이 없어서 써볼 수 없을 것 같습니다.

써보고 싶은데 좀 아쉽긴 하네요 ㅎㅎ


간단한 Object Pool 입니다

만든지 한 2년정도 된듯 한.. -_-;;

지금 보니 군더더기가 좀 있는 듯 하네요 ㅎㅎ

http://www.lua.org/

Lua

이번 프로젝트에서 사용할 예정

과연 어떤 녀석일까?? 궁금하다!!
Coding Standard is very important~!!

http://www.research.att.com/~bs/JSF-AV-rules.pdf
invalid-file

실행파일!

invalid-file

레포트 작성한 문서 파일!

invalid-file

이건 소스~~~~ ㅋ


거참.. 아무리 건성건성 하려고 해도

학교생활은 아무래도 만만치가 않다

다음주부터는 중간고사라고 하네 ㅎㅎ

그래도 졸업을 위해 꾸준히 레포트를 한다!! ㅋㅋ

이건 게임 프로그래밍 레포트!!

아싸~

+ Recent posts