unsigned double를 unsigned int로 처리하는 처리 시스템이 합법적입니까?
기대다
#include<stdio.h>
int main() {
unsigned double aa = 0.345;
signed double bb = 0.4509;
double cc = 0.472873;
printf("%f\n", aa);
printf("%f\n", bb);
printf("%f\n", cc);
}
gcc 오류prog.cc: In function 'int main()':
prog.cc:4:22: error: 'signed' or 'unsigned' invalid for 'aa'
unsigned double aa = 0.345;
^~
prog.cc:5:19: error: 'signed' or 'unsigned' invalid for 'bb'
signed double bb = 0.4509;
^~
그러나 비주얼스튜디오 2015ver 14.02541.01 업데이트 3warning C4076: 'unsigned': cannot be used with type 'double'
warning C4076: 'signed': cannot be used with type 'double'
warning C4477: 'printf' : format string '%f' requires an argument of type 'double', but variadic argument 1 has type 'unsigned int'
warning C4477: 'printf' : format string '%f' requires an argument of type 'double', but variadic argument 1 has type 'int'
되다우리 여기서 C4076의 설명을 읽으러 가자.Compiler Warning (level 1) C4076 | Microsoft Docs
'typemod' : can not be used with type 'typename'
A type modifier, whether it is signed or
unsigned
, cannot be used with a noninteger type. typemod is ignored.typemod is ignored 입니까?아니오, 저것은 ignore 가능합니까?의도에 어긋나는 코드를 만들 수 있습니까?
여기서 의문은 이것이 합법적인지 아닌지이다.
규격서를 읽다
조사 중입니다. 잠시만 기다리세요.우리도 정보 제공을 기다리고 있다...
C++11규격서 7.1.6(특히 7.1.6.2)이 문제가 될 수 있습니다.-TSUkasa#01[출고하려면](@a4lg)2017년 6월 21일
아직 규격서를 읽고 있지만 7.1.6으로 보면 특별한 제한이 없는 것 같다.
나는 이 일을 조사하기 위해 int long을 쓸 수 있다는 것을 이제야 알았다.unsigned double를 unsigned int로 처리하는 처리 시스템이 합법적입니까?by @yumetodo on @Qiita - 키토 돈지@ 작업(@SaitoAtsushi)https://t.co/zZXnCD5syB
Reference
이 문제에 관하여(unsigned double를 unsigned int로 처리하는 처리 시스템이 합법적입니까?), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/yumetodo/items/3bb5c9a4d68f544da939
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
Reference
이 문제에 관하여(unsigned double를 unsigned int로 처리하는 처리 시스템이 합법적입니까?), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/yumetodo/items/3bb5c9a4d68f544da939텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)