To catch possible issues with assigning or comparing values of different sizes, UEFI drivers should always be compiled with the highest warning level possible. For example, the Microsoft* compilers support the /WX and /W3 or /W4 compiler flags. The /WX flag causes any compile time warnings to generate an error, so the build stops when a warning is generated. The /W3 and /W4 flags set the warning level to 3 and 4 respectively. At these warning levels, any size mismatches in assignments and comparisons generate a warning. With the /WX flag, the compile stops when such size mismatches are detected.
If a UEFI Driver is being developed for a 32-bit architecture and is expected to be ported to a 64-bit architecture, it is a good idea to compile the UEFI driver with a 64bit compiler during the development process. This helps ensure the code is clean when validation on the 64-bit processor is begun. By using the /WX and /W3 or /W4 compiler flags, any size mismatches that are generated by only 64-bit code are detected.
TIP: As the warning levels are increased, a compiler may produce more error messages. This helps develop more robust, portable code.