알려주신 방법으로 하니 경고가 사라 졌습니다.
경고를 disable하는 방법도 알게 되었네요 ^^;
감사 합니다.
빌더(TWx) 님이 쓰신 글 :
: 뽀뽀중 님이 쓰신 글 :
:
: : template<typename Type>
: : static void Write(char* buffer, Type val, size_t pos=0, int bytes=0)
: : {
: : if (bytes == 0)
: : bytes = sizeof(Type);
: :
: : for (int i=0; i<bytes; ++i) {
: : buffer[pos+i] = (unsigned char)val;
: : val >>= 8; // <<= 경고발생
: : }
: : }
: :
: : 경고 메세지는 다음과 같습니다.
: : [bcc32c Warning] BasicExcel.hpp(462): shift count >= width of type
: : BasicExcel.cpp(2587): in instantiation of function template specialization 'YCompoundFiles::LittleEndian::Write<char>' requested here
:
:
:
: 답변:
:
: Implicite 컨버전을 피하려면...
:
: val = val >> 8;
:
: 을 쓸 수도 있고...
:
:
: clang 포팅 컴파일러에서 코드가 정당하다는 전제하에 워닝 메세지를 disable 하려면...
:
: ...
: #pragma clang diagnostic push
: #pragma clang diagnostic ignored "-Wshift-count-overflow"
: val >>= 8;
: #pragma clang diagnostic pop
: ...
:
|