En esta página

Código inalcanzable

Esta categoría de advertencia se escribe [unreachable-code] por qmllint.

Código inalcanzable

¿Qué ha ocurrido?

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

¿Por qué es malo?

El código inalcanzable no contribuye a la lógica del programa y sobrecarga el disco y la memoria de la aplicación. El código inalcanzable puede ser un signo de bugs subyacentes o errores lógicos.

Ejemplo

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

Para corregir esta advertencia, elimina las instrucciones muertas o refactoriza tu código para que toda la lógica sea alcanzable.

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.