|
cele 님이 쓰신 글 :
: 밑부분에 보면
:
: #if !defined(__USING_STD_NAMES__) && defined(__cplusplus)
: using namespace std;
: #endif /* __USING_STD_NAMES__ */
:
: 이렇게 정의 되어 있는데요,
: 실제로 <iostream> 을 불러다 쓸때
:
: using namespace std;
:
: 이걸 안쓰면 안되는게 이해가 안되거든요.
: 전처리 조건도 분명 맞는데.. 왜 그럴까요?
C++Builder 6.0의 iostream.h 파일을 전부 인용해보죠.
/**************************************************************************
* Wrapper header file used to select STL via defines.
* Default is STLport.
**************************************************************************/
/*
* C/C++ Run Time Library - Version 11.0
*
* Copyright (c) 2002 by Borland Software Corporation
* All Rights Reserved.
*
*/
#ifdef _USE_OLD_RW_STL
# include <oldstl\iostream.h>
#else
# include <stlport\iostream>
/* Define __STD_IOSTREAM__ here to cause sysclass.h to define
VCL_IOSTREAM which causes certian iostream operators to get defined
*/
#define __STD_IOSTREAM__
#endif
#if !defined(__USING_STD_NAMES__) && defined(__cplusplus)
using namespace std;
#endif /* __USING_STD_NAMES__ */
C++ 표준 제정 이전에는
#include <iostream.h>
의 형식으로 스트림 라이브러리를 인클루드했습니다. namespace의 개념도 없었죠.
반면에 C++98 표준에서는
#include <iostream>
형식으로 모든 표준 헤더 파일에 확장자가 없고,
반드시 std 네임스페이스를 사용해야 합니다.
즉, 위의 코드는 단지 표준 이전의 코드를 컴파일 할 수 있게 하기 위해서
using namespace std; 를 선언해 주는 것뿐이죠.
|