We’ve covered the major pseudocode formatting options previously but there is one more option which can influence the output. It is the radix used for printing numbers in the pseudocode.
In a positional numeral system, the radix or base is the number of unique digits, including the digit zero, used to represent numbers. For example, for the decimal/denary system (the most common system in use today) the radix (base number) is ten, because it uses the ten digits from 0 through 9.
(from Wikipedia)
The default radix setting is 0, which means “automatic”.
With this setting, the decompiler uses hexadecimal radix for values detected as unsigned, and decimal otherwise. For example, in the below screenshot, arguments to CContextMenuManager::AddMenu()
are shown in hex because the function prototype specifies the last argument type as “unsigned int”, while those for LoadStringA()
are in decimal because the decompiler used a guessed prototype with the type _DWORD
which behaves like a signed type.
In some cases, the decompiler may use hex even for signed numbers if it makes the number look “nice”. Currently (as of IDA 7.7), the following rules are used:
You can always change the representation for a specific number in pseudocode from the context menu or via a hotkey.
To toggle between decimal and hex, use the H hotkey. Octal is available only via the context menu by default, but it’s possible to add a custom hotkey for the action name hx:Oct
.
By changing Default radix in the decompiler options, you can have decompiler always use decimal (10) or hexadecimal(16) for all numbers without an explicitly set radix. Note that in this case the “nice” number detection will be disabled.
To change the default for all new databases, set the value DEFAULT_RADIX in hexrays.cfg
as described in the previous post.
More info: Configuration (Hex-Rays Decompiler User Manual)