Hex Editor - Binary File Editing Software for Windows
Download Hex Editor Neo Hide this button

$revert_to Directive

Syntax:

$revert_to(reference-expression);

This directive updates the current_offset. It may be used to have look ahead in a structure. reference-expression is evaluated at run-time and must be a reference to a field in the current type. After this directive executes, current_offset becomes the start of a field.

struct A
{
    int type;
    switch (type)
    {
        case 0:
            B b;
            break;
        case 1:
            C c;
            break;
        default:
            $revert_to(ref(type));
            D d;
    }
};