En esta página

Código inaccesible

qmllint escribe esta categoría de advertencia como « [unreachable-code] ».

Código inaccesible

¿Qué ha pasado?

Las instrucciones de tu código son inaccesibles y nunca se ejecutarán.

¿Por qué es un problema?

El código inaccesible no contribuye a la lógica del programa y aumenta el espacio ocupado en disco y en memoria por la aplicación. El código inaccesible puede ser un indicio de errores subyacentes o fallos lógicos.

Ejemplo

function f(b: bool) : string {
    if (b)
        return "true"
    else
        return "false"
    return "something else??" // unreachable statement
}

Para solucionar esta advertencia, elimina las instrucciones inútiles o refactoriza tu código para que toda la lógica sea accesible.

function f(b: bool) : string {
    if (b)
        return "true"
    else
        return "false"
}

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.