Why isn\'t 0f treated as a floating point literal in C++?
#include
using namespace std;
int main(){
cout << 0f <&l
Because the 0 is an integer constant.
edit: The error message given by codepad.org (assume g++) may be a little easier to understand. "error: invalid suffix "f" on integer constant". A "0.f" will work because 0. (or 0.0, same thing) is a decimal constant, and asking for a decimal constant to be a float makes more sense than asking for an integer constant to be a float :)