이 페이지에서

표현식에서 void 사용 금지

qmllint에서는 이 경고 범주를 ‘ [void] ’로 표기합니다.

void 표현식 사용 금지

무슨 일이 있었나요?

JavaScript void 표현식이 사용되었습니다.

왜 문제가 될까요?

void 표현식은 대체로 불필요해졌으며, 반환 값을 숨김으로써 일부 코드의 논리를 모호하게 만들 수 있습니다. 또한 명확하지 않고 가독성이 떨어지기 때문에 많은 코드 스타일 가이드에서 사용이 금지되어 있습니다.

예시

import QtQuick

Item {
    function undef() {
        return void 0
    }

    function f() {
        return void someFunction()
    }
}

이 경고를 해결하려면 void 사용을 제거하거나 대체하세요:

import QtQuick

Item {
    function undef() {
        return undefined
    }

    function f() {
        somefunction()
    }
}

© 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.