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.
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の 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)