레이블이 Programming인 게시물을 표시합니다. 모든 게시물 표시
레이블이 Programming인 게시물을 표시합니다. 모든 게시물 표시

9월 11, 2017

[EC++ 22] Declare data members private.


  • Data member를 private으로 설정함으로써 data member로의 accessibility를 더욱 세밀하게 컨트롤할 수 있다.
  • Data member를 functional interface 뒤에 숨김으로써 다양한 구현상 이점(유연함)을 얻을 수 있다.
  • Data member를 클라이언트에게서 숨기고 encapsulate 함으로써 클래스 불변성을 보장할 수 있으며, 후에 implementation decision 변경 시 좀 더 자유로울 수 있다.
  •  public (또는  protected )은 uncapsulated과 같은 의미로, 이는 해당 부분 및 연관된 부분에 대한 클래스 수정이 불가능함을 의미한다. 따라서, encapsulation의 관점에서는 사실상  public ( protected ) 이거나  private , 단 두가지의 선택지만이 존재한다.



Summary

  • Declare data members  private . It gives clients syntactically uniform access to data, affords fine-grained access control, allows invariants to be enforced, and offers class authors impementation flexibility.
  •  protected  is no more encapsulated than  public .

Reference

  • Effective C++ by Scott Meyers

7월 09, 2017

[EC++ 21] Don't try to return a reference when you must return an object.

  • reference는 이미 존재하는 object를 가리키는, '이름'일 뿐임을 명심하라.
  • function은 heap, 혹은 stack 오직 2가지 방법으로만 새로운 object를 생성할 수 있다.
  • 새로운 object를 리턴하는 제대로 된 방법은, object를 새로 만들어서 리턴하는 방법 뿐이다.
  • C++은 함수가 새로운 object를 생성하여 리턴할 때 컴파일러가 이런 일련의 과정을 최적화하는 것을 허용한다.
  • ex. Ellsion, Return Value Optimization 참조

  • 만약 리턴 값으로 reference와 new object 사이에서 선택을 해야하는 경우가 생긴다면, 다른 부분에 대해서 고민할 것 없이, 의도된 대로 올바른 동작을 제공하는 방식을 택해라. 최적화 등 기타 골치 아픈 문제들은 컴파일러 제작자가 고민하도록 내버려둬라.


Summary

  • Never return a pointer or reference to a local stack object, a reference to a heap-allocated object, or a pointer or reference to a local static object if there is a chance taht more than one such object will be needed. (Item4 provides an example of a design where returning a reference to a local static is reasonale, at least in single-threaded environments.)

Reference

  • Effective C++ by Scott Meyers

6월 25, 2017

[EC++ 20] Prefer pass-by-reference-to-const to pass-by-value.


Pass-by-reference-to-  const  

의 좋은 점
  • pass-by-value 로 인한 불필요한 ctor와 dtor의 호출을 막을 수 있다.
  • Slicing problem을 막을 수 있다.
  • param.로 어떤 객체를 받을 때, param.의 타입이 받으려는 객체의 base 클래스인 경우, param.로 그 객체를 받아 복사생성하는 과정에서 객체에서 derived 된 특성(data, function)이 잘려나가게 되는데, 이를 Slicing problem이라 한다.
  • 단, built-in type의 경우 pass-by value가 더 효율적이다. 이는 iterator나 function object in STL에도 해당되는데, 이런 기능들이 pass by value로 건네주도록 설계되었기 때문이다.
  • 작은 크기의 객체라고 해서 반드시 pass-by-value가 효과적인 것은 아니다.
  • 몇몇 컴파일러의 경우 built in type과 User defined type를 다르게 취급하는 경우가 있다. 또한 나중에 type의 설계가 변경됨에 따라 user defined type의 크기가 더 커지는 등의 변화가 있을 수도 있다.

  • 일반적으로, pass-by-value로 넘겨도 적은 비용이 든다고 보장할 수 있는 type은 built-in type과 STL iterator 또는 fucntion object type이다.


Summary

  • Prefer Pass-by-reference-to-  const   over pass-by-value. It's typically more efficient and it avoids the slicing problem.
  • The rule doesn't apply to built-in types and STL iterator and function object types. For them, pass-by-value is usually appropriate.

Reference

  • Effective C++ by Scott Meyers

[EC++ 19] Treat class design as type design

  • 다른 OOP 언어들과 마찬가지로, C++에서 새로운 클래스를 만든다는 것은 새로운 타입을 만드는 것과 같다.
  • 좋은 타입의 조건
    • 자연스러운 문법
    • 직관적인 문법
    • 하나 이상의 효율적인 구현 방법이 존재
    • 클래스 멤버 함수를 어떻게 선언되었는가에 따라 그 멤버 함수의 성능이 영향을 받을 수 있다


효율적인 클래스를 디자인하기 위해 생각해봐야 할 점

  • How should objects of your new type be created and destroyed?
  • How should object initialization differ frome object assignment?
  • What does it mean for objects of your new type to be passed by value?
  • What are the restrictions on legal values for your new type?
  • Does your new type fit into an inheritance graph?
  • 어떤 클래스를 상속 받으면 그 클래스의 디자인의 제한 요건을 따르게 되는데, 특히 virtual, non-virtual 과 같은 제한이 그렇다. 만약 자신이 설계한 클래스를 다른 클래스가 상속 받을 수 있도록 허용한다면 어떤 멤버가 virtual일지 결정해야하는데, 특히 destructor를 virtual 로 선언해야 한다.

  • What kind of type conversions are allowed for your new type?
  • What operators and functions make sense for the new type?
  • 어떤 멤버 함수를 제공할 것인가?

  • What standard founctions should be disallowed?
  • 무엇을 private으로 선언할 것인가?

  • Whoshould have access to the members of your new type?
  • What is the "undeclared interface" of your new type?
  • performance와 exception safety, 그리고 resource usage(locks, dynamic memory)에 있어 어떤 보장을 제공할 것인가?

  • How general is your new type?
  • class가 아니라 class template을 만들어야 할 수도 있다.

  • Is a new type really what you need?



Summary

  • Class design is type design. Before defining a new type, be sure to consider all the issues discussed in this Item.

Reference

  • Effective C++ by Scott Meyers

5월 29, 2017

[EC++ 18] Make interfaces easy to use correctly and hard to use incorrectly.

  • 클라이언트에게 어떤 것을 해야하는 책임을 지우는 인터페이스는 잘못 사용되기 쉽다. 클라이언트는 책임을 종종 잊어버리기 때문이다.
  • cross-DLL problem
  • 어떤 오브젝트가 한 DLL에서 생성된 후 다른 DLL에서 삭제되는 경우 런타임 오류를 일으키는 현상.  std::shared_ptr 은 deletor를 지정할 수 있는데, 이를 통해 cross-DLL problem을 피할 수 있다.



Summary

  • Good interfaces are easy to use correctly and hard to use incorrectoly. You should strive for these characteristics in all your interfaces.
  • Ways to facilitate correct use include consistency in interfaces and behavioral compatibility with built-in type.
  • Ways to prevent errors include creating new types, restricting operations on types, constraining object values, and eliminating client resource management responsibilities.
  •  tr1::shared_ptr  supports custom deleters. This prevents the cross DLL problem, can be used to automatically unlock mutexes (item 14), etc.

Reference

  • Effective C++ by Scott Meyers

3월 23, 2017

[EC++ 17] Store  new ed objects in smart pointers in standalone statements.


processWidget(std::tr1::shared_ptr(new Widget), priority());

위 코드는 1. new  메모리 할당 ->  shared_ptr  ctor call ->  priority()  call의 세 단계에 걸쳐 수행된다. 그런데 컴파일러에 의해  shared_ptr  ctor call과  priority()  call의 순서가 바뀔 수 있는데, 이 경우  priority() 가 예외를 던지면 memory leak이 발생하게 된다. 따라서  new ed object를   shared_ptr 에 넘겨주는 부분은 별도의 문장으로 따로 빼내는 것이 좋다.



Summary

  • Store  new ed objects in smart pointers in standalone statements. Failure to do this can lead to subtle resource leaks when exceptions are thrown.

Reference

  • Effective C++ by Scott Meyers

3월 22, 2017

[EC++ 16] Use the same form in corresponding uses of   new   and   delete  


  • 일반적으로 single object 와 array는 메모리 상의 구조가 다르다. single object는 메모리 상에 해당 object가 차지하는 공간만이 할당되지만, array는 메모리 상에 array의 크기를 먼저 기록하고 그 다음에 실제 object의 공간을 할당한다.
  • single object와 array는 메모리 상에 할당 되는 구조가 다르기 때문에 new와 delete를 사용하는 방법도 다르다. 따라서 single object와 array는   new    delete  를 사용하는 방법이 서로 다르며, 이를 뒤섞어 쓰면 안된다.
  • 이런 차이점 때문에, 클래스 설계 시 어떤 클래스가 동적 할당한 메모리를 가르키는 포인터를 멤버로 가지면서 여러 버전의 constructor를 제공한다면, 모든 constructor가 해당 포인터를 초기화하는데 모두 같은 형태의   new   를 사용하도록 주의해야 한다.
  •   typedef  를 사용할 때도 주의해야 한다. 예를 들어, array에 typedef를 사용하면 사용자는 typedef 된 자료형이 array인지 모르기 때문에 별 생각없이   new  -  delete  를 사용할 수 있다. 이 경우,   new[]    delete  를 같이 사용하는 것 같다.



Summary

  • If you use [] in a   new  expression, you must use [] in the corresponding   delete  expression, If you don't use [] in a   new  expression, you mustn't use [] in the corresponding   delete  expression.

Reference

  • Effective C++ by Scott Meyers

12월 20, 2016

[EC++ 15] Provide access to raw resources in resource managing classes.


resource leak 방지는 well-designed system의 필수 요소 중 하나이다. 이런 목적으로 resource 관리에 RAII class가 사용되지만, 때로는 resource에 직접 접근할 수 있는 방법이 필요하다. 많은 API가 자신의 parameter로 resource를 받아 이에 직접적으로 접근하기 때문에, 이런 API를 활용하기 위해 RAII class는 자신이 관리하는 resource에 직접 접근할 수 있는 수단을 제공해야 한다. 이러한 접근 수단에는 explicit, implicit 두가지 방식이 있다.

  • explicit
    •  get()  method 제공
  • implicit
    • overloaded derefencing operator( -> ),  * ) 사용
    • overloaded type conversion operator 사용

단, implicit conversion은 편리한 반면 오류의 원인이 되기도 하므로 신중하게 사용해야 한다. 아래의 프로그래밍 의도는 Font 객체의 복사였지만, 실제로는 f1이 FontHandle로 형변환 된 후 이것이 복사된다. font handle은 원래 Font class를 통해 관리되고 접근 가능해야 하지만, 실행 결과 이를 관리하는 RAII 객체를 통하지 않고도 직접적으로 접근이 가능해졌다.



Conclusion

RAII class가 explicit conversion과 implicit conversion 등 어떤 access 방법을 제공할지는 해당 RAII class가 수행하는 작업과 RAII class가 사용되는 상황에 따라 달라진다. 가장 좋은 design 방법은 interface을 올바르게 사용하기 쉽고 잘못 사용하기는 어렵게 만드는 것이다.

RAII class 내부의 raw resource를 반환하는 메소드를 제공하는 것은 C++의 encapsulation 원칙을 어겨 C++의 원칙과 모순되는 것처럼 보인다. 그러나 RAII class의 목적은 raw resource의 관리이지 encapsulation이 아니다. 뿐만 아니라  std::shared_ptr 과 같은 RAII class는 true encapsulation으로 구현되어, underlying resource의 loose encapsulation과 결합하여 결과적으로 더 강한 encapsulation을 제공한다.



Summary

  • APIs often require access to raw resources, so each RAII class should offer a way to get at the resource it anages.
  • Access may be via explicit conversion or implicit conversion. In general, explicit conversion is safer, but implicit conversion is more convenient for clients.

Reference

  • Effective C++ by Scott Meyers

12월 13, 2016

[EC++ 14] Think carefully about copying behavior in resource-managing classes.


Synopsis

mutex를 사용하는 경우,  lock(..)  unlock(..) 을 매 번 잊지 말아야 한다. 이를 해결하기 위해 RAII(Resource Acquisition Is Initialization) class의 사용을 고려해 볼 수 있다.



RAII object의 copy behavior 정의

  • Prohibit copy
  • RAII 객체의 copy operation을 허용하지 않아야 하는 경우가 많이 있다. 예를 들어 underlying resource가  std::mutex 인 경우 copy operation은 의미가 없을 뿐 아니라, 잘못된 동작을 초래할 것이다.

  • Reference-count the underlying resource
  • 동일한 객체가 여러번 사용되는 경우, 마지막 사용이 끝난 시점에서 resource가 release 되어야 한다. 이런 경우 적합한 방식이 reference-counting 방식으로,  std::shared_ptr 와 같은 구현 예가 있다.

    만약 자신의 RAII class에 reference counting 방식을 도입하고 싶다면 referece counting을 직접 구현하지 않고,  std::shared_ptr 을 멤버 필드로 정의하여 같은 효과를 볼 수 있다. Synopsis의 Lock class를 이러한 방식으로 구현할 수 있는데, 이 경우 RAII class의 Reference-count가 0이 되어도 mutex가 destruct되어선 안된다. 이 구현은  std::shared_ptr 의 deleter를 지정하여 해결할 수 있다.

  • Copy the underlying resource
  • Resource-managing class를 사용하는 이유가 오직, heap 메모리의 자동 해제 뿐인 경우, 동일한 resource의 카피를 여러 개 보유할 수도 있다. 이런 경우 resource-managing class의 copy operation은 해당 객체의 underlying resource를 deep-copy 해야 한다.

  • Transfer ownership of the underlying resource
  • copy behavior가 해당 객체의 underlying resource의 ownership을 이양하는 경우를 생각해 볼 수 있다. 이러한 구현의 예로  std::unique_ptr 가 있다.



Summary

  • Copying an RAII object entails copying the resource it manages, so the copying behavior of the resource determines the copying behavior of the RAII object.
  • Common RAII class copying behaviors are disallowing copying and performing reference counting, but other behaviors are possible.

Reference

  • Effective C++ by Scott Meyers

12월 12, 2016

SQL DML(Data Manipulation Language) tag:


SELECT

  • Syntax
  • SELECT [table.]attrib1, [table.]attrib2, ...
    FROM table1, table2, ...
    [WHERE search_condition]
    [GROUP BY attrib1, attrib2, ...]
    [HAVING search_condition]
    [ORDER BY order_expression[ASC|DESC]];
  • 조건 연산자
    • 비교연산자 : =, =>, =<, >, <, IN 등

    • 논리연산자 : AND, OR, NOT 등

    • LIKE연산자 : *(%), ?(_), # 등의 기호를 사용해 문자열을 검색

    • BETWEEN : 특정 값의 사이에 있는 튜플을 검색

  • group funtions :  WHERE  SELECT 와 함께 사용되어 표시할 튜플을 선택하는 기준이 된다면,  HAVING  GROUP BY 와 함께 사용되어 그룹을 묶는 기준이 된다. 하나의 그룹을 모집합으로 사용되는 함수로, 일반적으로  HAVING  절과 함께 사용되어 그룹에 대한 조건을 지정한다.
    •  COUNT(attrib 그룹별 튜플의 수를 구한다
    •  MAX(attrib 그룹별 최대값을 구한다
    •  MIN(attrib 그룹별 최소값을 구한다
    •  SUM(attrib 그룹별 합계를 구한다
    •  AVG(attrib 그룹별 평균을 구한다

INSERT

  • Syntax
  • INSERT INTO table_name(attrib1, attrib2, ...)
    VALUES(value1, value2, ...);
  • 테이블의 모든 속성 값을 입력하는 경우에는 table_name 뒤의 속성명을 생략할 수 있다.
  •  SELECT  문을 사용하여 추출한 검색 결과를 삽입할 수도 있다.

DELETE

  • Syntax
  • DELETE FROM table_name
    WHERE condition;
  •  WHERE  절을 생략하는 경우 해당 테이블의 모든 튜플이 삭제된다.

UPDATE

  • Syntax
  • UPDATE table_name
    SET attrib1=value1, attrib2=value2, ...
    WHERE condition;

reference

12월 07, 2016

\b의 용도


 \b

 \b 는 back space를 의미하는 escape sequence로,  \n 과 같이 다음 출력의 위치를 바꿔주는 역할을 한다.  \n 는 다음 출력의 위치를 다음 줄로 바꿔주는데,  \b 는 다음 출력의 위치를 이전으로 한칸 이동(back space) 한다. 아래 예를 참고하자.

cout << "asdf";    // (1) asdf
cout << "1234";   // (2) asdf1234

(1)이 실행되면 콘솔에서 asdf가 출력된다. 출력을 계속하면 다음에 출력할 문자는 f 뒤부터 출력이 되는데, 이는 콘솔 상에서 마지막 출력의 다음 위치를 cursor가 가르키고 있다가 출력이 재개되면 cursor의 위치부터 출력을 계속하기 때문이다. 만약 되돌려진 커서의 위치에 기존 출력의 내용이 있다면 기존의 출력을 새로운 출력으로 덮어쓰게 된다.

// _ (underline)은 커서의 위치
cout << "asdf";    // (3) asdf_
cout << '\b';        // (4) asdf
cout << "1234";   // (5) asd1234_

이를 응용해 이미 출력된 내용을 지울 수도 있다.

// \b로 커서를 하나 되돌린 후 ' '(공백)을 출력해서 기존 출력을 지운 후, 다시 커서를 되돌림
cout << "asdf";    // (6) asdf_
cout << "\b \b";    // (7) asd_

reference

12월 03, 2016

Regular expression 정규 표현식


Regular expression이란?

정규표현식 혹은 정규식이라고도 부른다. Regular expression(regex or regexp)은 특정한 규칙을 가진 문자열을 표현하는데 사용하는 형식 언어이다. regex는 VIM, EMACS 등 많은 텍스트 편집기와 다양한 프로그래밍 언어에서 문자열의 검색과 치환을 위해 지원하고 있다.

regex 문법은 편집기 별로, 프로그래밍 언어별로 전체적으로는 비슷하지만 조금씩 다른 부분이 있기 때문에, 사용 시에는 이런 부분에 유의하며 사용해야 한다.


요소

  • abc...   letters
  • 123...   digits
  • \d   any digits
  • \D   any non-digit character
  • .   Any character
  • \.   period
  • [abc]   only a, b, or c
  • [^abc]   not a, b, nor c
  • [a-z]   chracters a to z
  • [0-9]   numbers 0 to 9
  • \w   any alphanumeric character
  • \W   any non-alphanumeric character
  • {m}   m repetitions
  • {m, n}   m to n repetitions
  • *   zero or more repetitions
  • +   one or more repetitions
  • ?   optional character
  • \s   any white space
  • \S   any non-white space
  • ^...$   starts and ends
  • (...)   capture group
  • (a(bc))   capture sub-group
  • (.*)   capture all
  • (abc|def)   matches abc or def


reference

11월 29, 2016

rdbuf() : 서로 다른 두 스트림을 연결


std::ios::rdbuf()

일부 derived stream class(stringstream or fstream 등)는 객체 생성 시에 associated 된 internal stream buffer를 가진다. rdbuf는 stream의 associated stream buffer를 변경하는 함수로, stream buffer 자체에는 아무련 영향을 주지 않는다.

cin/ifstream, 혹은 cout/ofstream 등, 서로 다른 두 stream을 한 스트림에서 다른 스트림으로 리디렉시키는데 사용한다. 예를 들어 어떤 프로그램에서 input을 console과 cin을 통해 입력받는데, input을 입력받는 코드 부분을 수정하지 않고 file stream을 통해서 입력을 받도록 프로그램을 수정하고 싶을 때 유용하게 사용할 수 있다.

(1) streambuf* rdbuf() const;
(2) streambuf* rdbuf(streambuf* sb);

(1) accessor. 현재 stream의 associated streambuf의 포인터를 리턴.

(2) mutator. 현재 stream의 associated streambuf를 sb로 바꾸고 stream의 error state flags를 초기화. 이전 associated streambuf의 포인터를 리턴.


예제




reference

11월 25, 2016

SQL(Structured Query Language) 종류


SQL이란

RDBMS(Relational DataBase Management System)을 관리하기 위해 설계된 특수한 목적의 프로그래밍 언어로 데이터베이스로부터 정보를 얻거나 갱신하기 위한 표준 대화형 프로그래밍 언어. RDBMS에서 데이터베이스 스키마 생성과 수정, 자료 검색과 관리, 데이터베이스 객체 접근 권한 관리나 트랜잭션 관리 등을 위해 고안됨. DDL, DML, DCL 과 같이 세분화할 수 있음.


DDL(Data Definition Language)

SQL에서 RDBMS의 '구조'를 정의하는 언어 요소. 테이블 생성과 삭제, 변경 등을 담당.

  • CREATE
  • DROP
  • ALTER

DML(Data Manipulation Language)

SQL에서 '데이터 조작'을 위한 언어 요소. 데이터 검색, 등록, 삭제, 갱신을 담당.

  • INSERT INTO
  • SELECT .. FROM ..
  • DELETE FROM ..
  • UPDATE .. SET ..

DCL(Data Control Language)

SQL에서 데이터에 대한 액세스를 제어하기 위한 언어 요소. 권한의 부여, 박탈 등을 담당.

  • GRANT
  • REVOKE
  • SET TRANSACTION
  • BEGIN
  • COMMIT
  • ROLLBACK
  • SAVEPOINT
  • LOCK

Cursor

SELECT statment 실행 결과를 하나의 row 씩 처리하기 위해 서버 측의 result set과 row 획득 위치를 나타내는 개념을 의미. 주로 어플리케이션 등에서 SQL 검색을 실행 후 결과를 처리하기 위해 사용.


reference

SQL(Structured Query Language) 종류


SQL이란

RDBMS(Relational DataBase Management System)을 관리하기 위해 설계된 특수한 목적의 프로그래밍 언어로 데이터베이스로부터 정보를 얻거나 갱신하기 위한 표준 대화형 프로그래밍 언어. RDBMS에서 데이터베이스 스키마 생성과 수정, 자료 검색과 관리, 데이터베이스 객체 접근 권한 관리나 트랜잭션 관리 등을 위해 고안됨. DDL, DML, DCL 과 같이 세분화할 수 있음.


DDL(Data Definition Language)

SQL에서 RDBMS의 '구조'를 정의하는 언어 요소. 테이블 생성과 삭제, 변경 등을 담당.

  • CREATE
  • DROP
  • ALTER

DML(Data Manipulation Language)

SQL에서 '데이터 조작'을 위한 언어 요소. 데이터 검색, 등록, 삭제, 갱신을 담당.

  • INSERT INTO
  • SELECT .. FROM ..
  • DELETE FROM ..
  • UPDATE .. SET ..

DCL(Data Control Language)

SQL에서 데이터에 대한 액세스를 제어하기 위한 언어 요소. 권한의 부여, 박탈 등을 담당.

  • GRANT
  • REVOKE
  • SET TRANSACTION
  • BEGIN
  • COMMIT
  • ROLLBACK
  • SAVEPOINT
  • LOCK

Cursor

SELECT statment 실행 결과를 하나의 row 씩 처리하기 위해 서버 측의 result set과 row 획득 위치를 나타내는 개념을 의미. 주로 어플리케이션 등에서 SQL 검색을 실행 후 결과를 처리하기 위해 사용.


reference

11월 17, 2016

Random Access Iterator


Random-access Iterator?

자신이 가르키고 있는 element과 연관되어 있는 임의의 position에 접근하여 포인터와 같은 functionality 를 제공할 수 있는 iterator. 모든 Random-access iterator 는 bidirectional iterator이며, 어떤 element에도 constant time으로 접근할 수 있음.


Funtionalities of Random-access Iterator

  • Bidirectional Iterator 가 제공하는 모든 기능
  • Arithmetic operator ex) it1+n, n+it1, it1-n, it1-it2
  • Inequality relation operator ex) it1<it2, it2>it1, it1<=it2, it1>=it2
  • Compound assignment operator ex) it1+=n, it1-=n
  • Offset dereference operator ex) it1[n]

reference

Bidirectional Iterator


Bidirectional Iterator

유효한 범위의 sequance of element에서 begin, end 양방향의 element에 모두 access 가능한 iterator. 모든 Bidirectional iterator 는 Forward Iterator.


Funtionalities of Bidirectional Iterator

  • Default/copy/copy-assignment constructible ex) X it1; , X it2(it1); , it2 = it1;
  • In/Equality operator ex) it1==it2, it1!=it2
  • Dereference as R-value ex) *it1, it1->m
  • Dereference as L-value ex) *it1 = t
  • Increment ex) ++it1, it1++
  • Decrement ex) --it1, it1--
  • L-value are swappable ex) swap(it1, it2)

X는 Bidirectional iterator type, m은 가르키는 멤버, t는 iterator가 가르키는 타입의 object.


reference

11월 02, 2016

Visual studio 에서 C++ 프로젝트 작성 시 arguments 주는 방법


프로젝트 속성 > 디버깅 > 명령 인수

에 인수를 넣어준다. 인수는 공백(space or tab)으로 구분되며, 공백이 포함된 문자열을 하나의 인수로 전달 시엔 문자열을 큰 따옴표("")로 감싸준다.


reference

11월 01, 2016

ODBC data source 설정 시 ODBC driver for SQL server ODBC 항목이 나오지 않는 경우 해결 방법


증상

ODBC data source Administrator 에서 새로운 data source 를 만들 때 드라이버 선택 메뉴에서 ODBC driver for SQL Server 항목이 나타나지 않음.
(SQL Server 등 다른 선택 항목은 존재)


원인

ODBC driver가 설치되지 않았기 때문.


해결 방법

  • Microsoft ODBC driver for SQL Server를 설치
  • SSMS 설치(설치 과정에서 ODBC driver가 함께 설치됨)

reference

  • -