HP (Hewlett-Packard) 5992-4701 Computer Hardware User Manual


 
9.4.1 C and C++
Since C and C++ are so closely related, many features of GDB apply to both languages.
Whenever this is the case, we discuss those languages together.
The C++ debugging facilities are jointly implemented by the C++ compiler and GDB.
Therefore, to debug your C++ code effectively, you must compile your C++ programs
with a supported C++ compiler, such as GNU g++, or the HP ANSI C++ compiler (aCC).
For best results when using GNU C++, use the stabs debugging format. You can select
that format explicitly with the g++ command-line options '-gstabs' or '-gstabs+'.
Refer to section “Options for Debugging Your Program or GNU CC” in Using GNU
CC, for more information.
9.4.1.1 C and C++ operators
Operators must be defined on values of specific types. For instance, + is defined on
numbers, but not on structures. Operators are often defined on groups of types.
For the purposes of C and C++, the following definitions hold:
Integral types include int with any of its storage-class specifiers; char; enum; and,
for C++, bool.
Floating-point types include float, double, and long double (if supported by
the target platform).
Pointer types include all types defined as (type *).
Scalar types include all of the above.
The following operators are supported. They are listed here in order of increasing
precedence:
,
The comma or sequencing operator. Expressions in a
comma-separated list are evaluated from left to right, with the
result of the entire expression being the last expression evaluated.
=
Assignment. The value of an assignment expression is the value
assigned. Defined on scalar types.
op=
Used in an expression of the form a op= b, and translated to a = a
op b. op= and = have the same precedence. op is any one of the
operators |, ^, &, <<, >>, +, -, *, /, %.
?:
The ternary operator. a ? b : c can be thought of as: if a then b else
c. a should be of an integral type.
||
Logical OR. Defined on integral types.
&&
Logical AND. Defined on integral types.
|
Bitwise OR. Defined on integral types.
^
Bitwise exclusive-OR. Defined on integral types.
&
Bitwise AND. Defined on integral types.
106 Using GDB with Different Languages