gcc의 -finput-charset 옵션의 기본값에 대한 질문입니다.

hwayak의 이미지

gcc 4.3.3의 매뉴얼을 보면 -finput-charset 옵션의 기본값에 대해서 아래와 같이 적혀 있습니다.

If the locale does not specify, or GCC cannot get this information from the locale, the default is UTF-8. 
This can be overridden by either the locale or this command line option.
Currently the command line option takes precedence if there's a conflict.

하지만 ubuntu 9.04에서 gcc 4.3.3을 기준으로 제 스스로 테스트해본 봐로는 시스템의 로케일 설정에 관계없이 항상 기본값은 UTF-8인 듯 합니다.

여러분들은 어떠신가요?

참고로 저는, 시스템 로케일 설정이 ko_KR.euckr, test.c라는 소스 코드 파일이 UTF-16LE(bom 없음) 인 상태에서 아래와 같이 테스트를 했봤습니다...

$ gcc test.c
(온갖 잡다한 컴파일 오류 메세지 출력)
$ gcc -finput-charset=UTF-8 test.c
(위와 동일한 컴파일 오류 메세지 출력)
$ gcc -finput-charset=EUC-KR test.c
cc1: error: failure to convert EUC-KR to UTF-8
$ gcc -finput-charset=UTF-16LE test.c
(정상으로 컴파일 됨)

그리고 사용한 소스 코드는 정확히 아래와 같습니다.

int main() {
    return 0;
}