Cpp.False Class
Namespace: Cpp
Superclasses: AstNodeProperties
Represents the false nodes in the syntax tree of your code
Since R2026a
Description
The PQL class Cpp.False represents the node false in the syntax tree of your code.
void foo() {
if (false) {
// unreachable
}
}The if (false) contains the false literal which corresponds to the false node matched by Cpp.False in PQL.
Predicates
| Type | Raisable | Printable |
|---|---|---|
False
| Yes | No |
This class defines these predicates that act on the objects of this class. In addition, objects of this class can access the predicates defined by the base class AstNodeProperties. An object of this class is an object of AstNodeProperties class.
| Predicates | Description | Example |
|---|---|---|
is(required False &false)
| Match a false literal node and return it through the output variable. Use this to directly find false tokens in code. |
This PQL defect checks for defect find_false_is =
when
Cpp.False.is(&f)
and f.nodeText(&txt)
raise "Found false via is: \"{txt}\""
on fIn this C++ code, the defect finds the
// compile with: g++ -std=c++17 example_is.cpp -o example_is
#include <iostream>
int main() {
if (false) { // matches Cpp.False.is
std::cout << "won't run\n";
}
return 0;
} |
is(required Cpp.False &false)
| Matches a false literal and binds it to the given output variable for further checks or reporting. |
This PQL defect checks for occurrences of a defect false_is_example =
when
Cpp.False.is(&f)
and f.nodeText(&txt)
raise "Found false literal: \"{txt}\""
on fIn this C++ code, the defect finds the
#include <iostream>
int main() {
if (false) {
std::cout << "won't run\n";
}
return 0;
} |
cast(Cpp.Node.Node node, required Cpp.False &cast)
| Checks whether a given Node is a false
literal and if so returns the false node as the output variable
for further inspection. | This PQL defect checks whether a previously obtained node is the
defect false_cast_example =
when
Cpp.node.is(&n,&,&,&)
and Cpp.False.cast(n, &f)
and f.nodeText(&txt)
raise "Cast confirmed false literal: \"{txt}\""
on fIn this C++ code, the defect finds a
int main() {
bool b = false;
return b ? 1 : 0;
} |
isa(Cpp.Node.Node node)
| Returns true when the given generic Node is a false literal allowing negation or conditional checks in queries. | This PQL defect checks whether a generic node corresponds to a
defect false_isa_example =
when
Cpp.node.is(&n,&,&,&)
and Cpp.False.isa(n)
raise "Node is a false literal"
on nIn this C++ code, the defect finds a
void test() {
if (false) {
// intentionally empty
}
} |
Version History
Introduced in R2026a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)