It's standard behaviour that the token 42f is ill-formed and not a floating-point literal:
float a = 42f; // ERROR
whereas this works:
and as not many people know this works:
float a = 42.f; // OK
This is because:
decimal-floating-point-literal:
fractional-constant exponent-part_opt floating-point-suffix_opt
digit-sequence exponent-part floating-point-suffix_opt
fractional-constant:
digit-sequence_opt . digit-sequence
digit-sequence .
I wonder why we need the redundant `.0` or `.`? What would we think of a proposal that allows an integer to be followed by `f`?
As in:
decimal-floating-point-literal:
fractional-constant exponent-part_opt floating-point-suffix_opt
digit-sequence exponent-part floating-point-suffix_opt
digit-sequence float-floating-point-suffix
float-floating-point-suffix: one of
f F
Where a `decimal-floating-point-literal` of the form `digit-sequence float-floating-point-suffix`, DF, where D is the `digit-sequence` and F is the `float-floating-point-suffix`, is equivalent to D.0F