본문 바로가기

전체 글51

에러값 리턴 이런짓은 되도록 하지 말자 jwqe764241::error::ERROR__ jwqe764241::registry::openRegistry( _In_const HKEYhRoot, _In_const wchar_t * lpSubKey, _Out_HKEY&result ) { jwqe764241_ASSERT(hRoot != NULL && lpSubKey != NULL, "Arguments must not be a NULL value"); jwqe764241::error::ERROR__ returnCode = RegOpenKeyEx(hRoot, lpSubKey, NULL, KEY_ALL_ACCESS, &result); if (returnCode == ERROR_SUCCESS) { return ERROR_OK; } .. 2017. 5. 23.
assertion assertion은 간단하게 말해서 프로그램 실행시간에 조건을 강제한다고 보면 된다. 다른말로 하자면 그 조건에 무조건 만족해야만 하도록 할 때에 그 조건을 검사하기 위해 하는것이라고 보면 된다. 또 다른말로 하자면 에러검출, 데이터체킹이라고 보면 된다. cassert에 적혀있는 assert는 다음과 같다.#ifdef NDEBUG #define assert(expression) ((void)0) #else _ACRTIMP void __cdecl _wassert( _In_z_ wchar_t const* _Message, _In_z_ wchar_t const* _File, _In_ unsigned _Line ); #define assert(expression) (void)( \ (!!(expression)).. 2017. 5. 18.
네이밍 얼마전 Java언어를 사용하는 학교 과제를 하고 있었는데, 코드를 잠깐 보던 친구가 내 코드의 함수명을 보고 이렇게 말하였다... Q : 너 변수명도 대문자로 시작하고 패키지명도 2번째 파일부터 대문자로 시작하는데 자바 컨벤션은 이렇게 하지 말라고 되어있는데 왜 이렇게 했니? 위의 링크로 들어가 보면 밑에 처럼 작성되어 있는 것을 볼 수 있을 것이다. Naming conventions make programs more understandable by making them easier to read. They can also give information about the function of the identifier-for example, whether it's a constant, package, o.. 2017. 5. 6.