In C++ I've actually had code using a value like `42l` that works on Linux but not on Windows, because the sizes of those types aren't fixed.
if you want fixed size for literals you can use the "function macros for integer constants" :
#include <cstdint>
auto x = INT32_C(-456456435); // guaranteed at least 32-bit
auto y = UINT64_C(45645654654321685768); // guaranteed at least 64-bit.
Those will enclose the constant in the proper literal suffix - ull on 32-bit windows and ul on linux for instance.I've only dabbled with rust, but I came across this very early on, and was baffled by the syntax. After further dabbling, I still can't see it and immediately know what the value is.
let variable_name [: type] = value[(i|u|f)bits];
In rust, 123l is written 123i64 or 123i32 (also 123_i32, or 1_2_3i32), depending on what 123l actually means.
I don't actually use rust, but it seems very clear and obvious to me (obvious once you know the syntax above).
let (a, b) = some_two_tuple;
will introduce two varaibles, a and b, as respective halves of the tuple.I realise of course that not everyone will feel the same.
So something like this (rust):
`16i32`
Compared to something like this (C#):
`16i`
`int x = 42;`
But since int (32-bit integer) is the default integer type, you can also do:
`var x = 42;`
If you want to use another type, for example, ulong (unsigned, 64-bit integer), you can do:
`ulong x = 42;`
Or:
`var x = 42ul;`
C#'s syntax is not only terser, but seems a lot easier to read to me. With rust's syntax, it's not immediately clear what the value is, and what the type is.