Igor’s Tip of the Week #160: Hiding casts in the decompiler

In order to faithfully represent the behavior of the code and to conform to the rules of the C language, the decompiler may need to add casts in the pseudocode. A few examples:

  • a variable has been detected to be unsigned but participates in a signed comparison:
  • An argument being passed to a function does not match the prototype:


  • A narrow value (less that register size) is being loaded from or stored to memory:
  • Actual arguments being passed to a function call do not match the prototype (or the prototype is not known):
  • and so on

In some cases you may want to only look at the overall structure of the function and casts can be distracting. In such case you can hide them by using the “Hide casts” context menu action, or the shortcut \ (backslash).

To turn them back on, use the “Show casts” action (same shortcut).

NB: while hiding casts may result in “cleaner-looking” pseudocode, the result may be no longer correct C and hide various issues visible with casts. So it is not recommended to leave them off permanently. And if you notice that the output seems to be wrong (for example, pointer math does not correspond to the assembly), it may be caused by the accidental pressing of the backslash, so check the context menu and show casts again if they were off.

See also:

Decompiler Manual: Hex-Rays interactive operation: Hide/unhide cast operators