기본 콘텐츠로 건너뛰기

2016의 게시물 표시

PyCharm 설치, 설정, 프로젝트 만들기

URL: [Python] 윈도우 개발환경 구축 - PyCharm 설치, 설정, 프로젝트 만들기 http://nexablue.tistory.com/entry/Python-%EC%9C%88%EB%8F%84%EC%9A%B0-%EA%B0%9C%EB%B0%9C%ED%99%98%EA%B2%BD-%EA%B5%AC%EC%B6%95-PyCharm-%EC%84%A4%EC%B9%98-%EC%84%A4%EC%A0%95-%ED%94%84%EB%A1%9C%EC%A0%9D%ED%8A%B8-%EB%A7%8C%EB%93%A4%EA%B8%B0

[c/c++] printf, wprintf 관련 format string 기술자

링크: https://msdn.microsoft.com/en-us/library/tcxf1dw6.aspx 링크를 보시면 이해가 빠른데, "%I64d" 는 "%" + "I64" + "d" 이렇게 3부분으로 나눌수 있습니다. 중간은 생략 가능해서 생략하는 경우가 많다 로 이해하시면 쉬울듯 저도 혼돈스러워 다시 정리합니다. 추가로 몇개 더 정리하면 다음과 같습니다. %Id - 32bit platform - long 타입 / signed  - 64bit platform - longl.ong 타입 / signed  %I64d - longlong / signed %I64u - longlong / unsigned

[C/C++] VS2010 lambdas log 남기는 것에 대한 테스트 프로그램

// lambdas 함수에서 함수명 로그 남기는 방법은 없음 #include "stdafx.h" #include <iostream> void f2(){ auto& _func_ = __FUNCTIONW__; auto fx2 = [&]{ std::wcout << _func_ << L"\n"; std::wcout << __FUNCTIONW__ << L"\n"; }; fx2(); } struct XOUT{ void f(){ auto& _func_ = __FUNCTIONW__; auto fx2 = [&]{ std::wcout << _func_ << L"\n"; std::wcout << __FUNCTIONW__ << L"\n"; }; fx2(); } }; int _tmain(int argc, _TCHAR* argv[]) { struct X{ void f(){ auto& _func_ = __FUNCTIONW__; auto fx2 = [&]{ std::wcout << _func_ << L"\n"; std::wcout << __FUNCTIONW__ << L"\n"; }; fx2(); } }; auto& _func_ = __FUNCTIONW__; auto fx2 = [&]{ std::wcout << _func_ << L"\n"; }; fx2(); f2(); //XOUT.f(); // 컴파일 오류 남 XOUT().f(); //X.f();

[C/C++[ shift 연산 음수로 이용하기

x = k >> -e // 이건 뭐 어쩌자는 건지? c++ 소스 중에  오늘 위와 같은 형식의 shift 연산을 보고 결과가 궁금해서 테스트를 해봤다. 결론은 shift 연산자 우측에 음수가 오면 무조건 0 즉 -e 이렇게 쓴것은 e 의 값이 음수라는 이야기 이다. #include "stdafx.h" template<typename T> void test_minus_shift(T value) { //T value = 1; T nShfitLeft = value << 1; T nShfitLeftMinus = value << -1; T nShfitRight = value >> 1; T nShfitRightMinus = value >> -1; } int _tmain(int argc, _TCHAR* argv[]) { test_minus_shift<int>(1); // nShfitLeft=2, nShfitLeftMinus=-21474836, nShfitRight=0, nShfitRightMinus=0 test_minus_shift<int>(8); // nShfitLeft=16, nShfitLeftMinus=0, nShfitRight=4, nShfitRightMinus=0 test_minus_shift<int>(0xfc31); // nShfitLeft=129122, nShfitLeftMinus=-21474836, nShfitRight=32280, nShfitRightMinus=0 test_minus_shift<unsigned>(1); // nShfitLeft=2, nShfitLeftMinus=21474836, nShfitRight=0, nShfitRightMinus=0 test_minus_shift<unsigned>(8); // nShfitLeft=16,

[C/C++] int형, float형 나눗셈/나머지 구하기 연산 결과

// divmod_test.cpp : int형, float형 div/mod 연산 테스트 // #include "stdafx.h" void test_divmod() { int nzero = 0; //int nd = 20 / nzero; // VS2010 runtime error //int nm = 20 % nzero; // VS2010 runtime error float fzero = 0.f; float fk = 20.f / fzero; // VS2010 no error!!! - fk = '1.#INF000' //float fj = 20 % fzero; // VS2010 compile error - float type not support modulation operation. printf("fk(%f)", fk); } int _tmain(int argc, _TCHAR* argv[]) { test_divmod(); return 0; }

[c++], lvalue, rvalue 에 대한 추가적 정리

 Lvalue를 대입 연산자 왼쪽에 있는 값, RValue를 대입 연산자 오른쪽에 있는값으로 알고 있는 사람이  많습니다. C에서는 이 개념이 맞지만 C++ 98/03에서는 약간 다른 개념으로 사용됩니다. 저도 C에서의 개념으로만 알고 있었는데, 컴파일러와 정적 분석 도구로, 오류 원인을 추적하다 보니, 개념을 좀 더 명확하게 할 필요가 있어서, 구글링(?) 하다가 좋은 자료가 있어 공유 합니다. 참고 링크:  http://scor7910.tistory.com/66 이상입니다.

C++ 소스 정적 분석 도구들

소스 정적 분석 도구 1. PC-Lint (유료) 1.1 PC-Lint/PC-Lint Plus 유료 구매 1.2 Visual Lint(GUI Intergrations) - PC-Lint 별도 구매 필요 1.3 ALOA(A Lint Output Analyzer) - PC-Lint 별도 구매 필요 2. PC-Lint 유사 도구 2.1. CppCheck (OpenSourrce) - http://sourceforge.net/projects/cppcheck/?source=typ_redirect 2.1.1. 참고링크 2.1.1.1 위키 링크  https://en.wikipedia.org/wiki/Cppcheck 2.1.1.2. 설정 참고용 링크  http://del4u.tistory.com/28 2.1.2. CppCheckUi.exe - WindowUI App UI 프로그램도 별도로 있는데, 프로젝트 파일을 make 파일과 c, cpp 소스 파일들만 지원해서 사용하지 않았음. 2.1.3 VS2010 설정 화면 2.1.3.1 메뉴 에서 Tools > External Tools 선택 , 화면에서 “Add” 추가후 아래 항목 입력 Title: CppCheck Command: C:\Program Files\Cppcheck\cppcheck.exe Argument: --enable=* -q --template vs $(ProjectDir) Initial Directory: $(ProjectDir) 2.1.3.2.  참고로 , MSVCP14.DLL 오류가 발생하면 CS2015 재배포패키지가 설치해야 합니다 . 2.1.3.3 CppCheck.exe 파라메터 설명 C:\Program Files\Cppcheck>cppcheck.exe Cppcheck - A tool for static C/C++ code analysis Syntax:     cppcheck [OPTIONS] [fi

C++ 에서 Singleton 형태

C++에서 Singleton 형태(Effective C++에서 참고) // 정의 class Singleton { private: // 외부 이용 제한 (생성과 복사, 삭제 제한이 목적)     Singleton() {}; // 생성자     Singleton(const Singleton& other);  // 복사 생성자     ~Singleton() {}; // 소멸자     //static Singleton* instance; // 내부에서 하나의 값으로 유지하기 위한 변수 public: // 외부 사용 허가     //static Singleton* GetInstance()     //{     //    if(instance == NULL)     //        instance = new Singleton();     //    return instance;     //}     static Singleton* GetInstance()     {         static Singleton ins;         return &ins;     } }; //Singleton* Singleton::instance = nullptr;  // static 정의 대한 클래스 외부 정의 // 사용시 Singleton::GetInstance() // 형태로 이용하거나 Singletone* instance = Singleton::GetInstance(); // 형태로 이용 이것말고도 Singleton 관련하여 추가적인 내용들도 있습니다. PhoenixSingleton, TemplateSingleton 관련해서는 추가로 검색해서 보세요. 링크: http://vallista.tistory.com/entry/1-Singleton-Pattern-in-C