목록


1. boolalpha

bool 값을 출력 시 자동으로 "true", "false" 로 변환

bool True = true;
bool False = false;
cout << boolalpha << True << endl; // true
cout << boolalpha << False << endl; // false

2. new(nothrow)

new가 실패하면 예외가 발생하며 일반적으로 프로그램을 종료함.

예외 발생하지 않고 nullptr을 리턴하는 new(nothow)

int* ptr = new(nothrow) int(3);

3. FILE

파일의 실행전체 경로

만약 파일 이름만 알고싶으면?

#include <string.h>
#define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)

4. #pragma

전처리기에 무슨 명령을 전달할 때 사용