Closed bocchino closed 2 years ago
@LeStarch Do we actually want the u suffix? It looks like with -Wconvert this is OK
unsigned x = 1
but this generates a warning
unsigned x = -1
We can remove the warning in the second case with
unsigned x = -1u
But is that what we want? This is indeed an odd case that should perhaps be avoided.
As discussed, eventually we should tighten the FPP semantics to catch these weird conversions when checking the model, but in the mean time it seems good to err on the side of warning, as long as there is a workaround. For example instead of
struct S { x: U32 } default { x = -1 }
the user can write
struct S { x: U32 } default { x = 0xFFFFFFFF }
and maybe the second way should be encouraged.
We definitely need the f suffix because
struct S { x: F32 } default { x = 1.0 }
should not generate a warning.
I don't know we need the u
suffix as I haven't seen WARNING about this. Writing 0xFFFFFFFF
should likely be encouraged.
OK, I will add f for F32 and that's it.
Done in commit e437e82f308e02e8d91930b0b245ff3a585dc5c9.
For compliance with strict C++ compiler checking. Known suffixes:
L and/or LL are thankfully not required in C++ for {I,U}64.