could any please explain the below code
const uInt32 eVal = 8ul;
const uInt32 fVal = 5ul;
const uInt32 zVal = 0ul;
what does ul and numbers 8,5,0 are stand for
could any please explain the below code
const uInt32 eVal = 8ul;
const uInt32 fVal = 5ul;
const uInt32 zVal = 0ul;
what does ul and numbers 8,5,0 are stand for
It's the programmer being unnecessarily verbose. ul
is the prefix for an unsigned long
literal, so 8ul
has an unsigned long
type.
Most likely, that isn't the same type as the uInt32
, so really the code you present is an exercise in obfuscation. Really they should rely on the automatic implicit conversion rules and write
const uInt32 eVal = 8;
const uInt32 fVal = 5;
const uInt32 zVal = 0;
perhaps even preferring constexpr
in place of const
.
Reference: http://en.cppreference.com/w/cpp/language/implicit_conversion
ul stands for unsigned long representation of numbers. Here the number 8 or 5 or 0 of type unsigned long is being assigned to constant uInt32 type variable.
The 'ul' is used for representation. It need not be used also.