접근 불가능한 코드
qmllint에서는 이 경고 범주를 ‘ [unreachable-code] ’로 표기합니다.
실행되지 않는 코드
무슨 일이 발생했나요?
코드에 포함된 명령문은 도달할 수 없어 절대 실행되지 않습니다.
왜 문제가 될까요?
실행 불가능한 코드는 프로그램 논리에 기여하지 않으며, 애플리케이션의 디스크 및 메모리 사용량을 불필요하게 증가시킵니다. 실행 불가능한 코드는 근본적인 버그나 논리 오류의 징후일 수 있습니다.
예시
function f(b: bool) : string {
if (b)
return "true"
else
return "false"
return "something else??" // unreachable statement
}이 경고를 해결하려면 실행되지 않는 명령문을 제거하거나, 모든 논리가 실행 가능하도록 코드를 리팩토링하십시오.
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.