Why isn't “0f” treated as a floating point literal in C++?

后端 未结 6 641
暖寄归人
暖寄归人 2020-12-03 21:19

Why isn\'t 0f treated as a floating point literal in C++?

#include 

using namespace std;

int main(){
  cout << 0f <&l         


        
6条回答
  •  再見小時候
    2020-12-03 22:04

    Here's a 'because' for you: if an int constant with an f suffix was automatically converted to float, then 0x0f would be ambiguous.

提交回复
热议问题