You can conduct a fully or partially qualified name search. Further
qualifying a search increases the accuracy and relevance of search results. The
sections below provide guidance on how to control the scope of your search
through the use of search delimiters, correct syntax, and wildcards.
You can search for:
- language constructs within:
- projects in your workspace
- selected resources from various views
- working sets
- a working set for references to particular elements
- declarations of particular elements
- definitions of particular elements
- references of particular elements
For information on working sets, see Workbench User Guide > Concepts > Workbench > Working sets
What you can search for
The table below lists the element types that you can search for and special
considerations to note when searching for a given element type. You can search
for some or all of the element types matching a search string that you
specify. If you choose to search for matching elements, all types, macros, and typdefs are included in the search.
||Searches for classes and structs.
You can further qualify
the search by specifying "class" or "struct" in front of the name
that you are
searching for. Specifying "class" or "struct" also allows you to
search for anonymous classes and structures.
||Searches for global functions or functions in a namespace
(functions that are not members of a class, struct, or union).
specify parameters to further qualify your search. When specifying a
parameter list, everything between the parentheses should be valid C/C++
Do not specify the return type of the function.
||Searches for variables that are not members of a class,
struct, or union.
||Searches for unions.
Anonymous unions can be searched for by
specifying "union" as the search pattern.
||Searches for methods that are members of a class, struct, or
Searching for methods also finds constructors and destructors. See
above note for functions.
||Searches for fields that are members of a class, struct, or
||Searches for enumerations.
||Searches for enumerators.
||Searches for namespaces.
How you can limit your search
You can limit your search to one or all of the following:
- Definitions (for functions, methods, variables and fields)
You can control the scope of the search by specifying which of the following
is to be searched:
- Working Set
- Selected Resources
You can use wildcard characters to further refine your search.
Use this wildcard character
To search for this
Use the character * to search for
operators that begin with *. See syntax examples in the table below.
||A single character
Tip: Do not use wild cards between the brackets of a function or
method pattern. For example, the search
string f( * ) is an invalid search that results in a search for any function f
the asterisk is interpreted as a pointer rather than a wild card.
The table below provides syntax examples and an explanation for each example
to help you conduct an effective search.
Searches for this
||A nested element two levels deep
||Any two-letter name that begins with A and is two levels
||Searches for A not nested in anything
||Any function taking no parameters
| *( A * )
||Any function taking 1 parameter that is a pointer to type
| f( int * )
||Will search for function f taking 1 parameter that is an
| f( const char [
], A & )
||Will search for a function f, taking 2 parameters; one is a
const char array, the other is a reference to type A
| operator \*
||Finds only operator *
| operator \*=
||Finds only operator *=
| operator *
||Finds all operators
||Searches for anonymous classes
||Searches for anonymous structs
||Searches for anonymous unions
Search results are displayed in the Search view. You can sort your search by Name, Parent Name and Path. You can also repeat
your last search.
According to the ANSI C++ Spec, a declaration is a statement that “introduces a name into a translation unit or re-declares a name that has been previously introduced by a previous declaration.
All C/C++ search elements can be searched for declarations.
Most declarations are also definitions; in other words, they also define the entity for they declare the name for. However there are some elements that can have separate definitions from their declarations.
For C/C++ search the following elements can be searched for definitions:
- Functions/Methods – the definition is where the code implementation resides
- Extern – the definition is where the variable is initialized
- Non extern - the definition of a variable is where it is declared
- Static fields - the definition of a static field is where it gets initialized
- Non static fields - the definition corresponds to the fields declaration
- Namespace – the definition of a namespace is the same as its declaration
By selecting references, C/C++ search will return all of the places the selected element is used.
Selecting ‘All Occurrences’ in the Limit To section will result in a search for declarations, definitions (if applicable) and references for whatever element or elements have been selected.
Selecting ‘Any Element’ in the Search For section will result in a search for all of the listed elements plus macros and typedefs.
For more information, see:
- Workbench User Guide > Concepts > Views > Search view
- Workbench User Guide > Tasks > Navigating and finding resources
Searching for C/C++ elements
Navigating to C/C++ declarations
C/C++ search page, Search dialog box
C/C++ perspective icons