Debugging with GDB (September 2007)
Chapter 9: Using GDB with Different Languages 85
==, != Equality and inequality. Defined on scalar types. The value of these expressions
is 0 for false and non-zero for true.
<, >, <=, >=
Less than, greater than, less than or equal, greater than or equal. Defined on
scalar types. The value of these expressions is 0 for false and non-zero for true.
<<, >> left shift, and right shift. Defined on integral types.
@ The GDB “artificial array” op e rator (see Section 8.1 [Expressions], page 63).
+, - Addition and subtraction. Defined on integral types, floating-point types and
pointer types.
*, /, % Multiplication, division, and modulus. Multiplication and division are defined
on integral and floating-point types. Modulus is defined on integral types.
++, -- Increment and decrement. When appearing before a variable, the operation is
performed before the variable is used in an expression; when appearing after it,
the value of the variable is used before the operation takes place.
* Pointer dereferencing. Defined on pointer types . Same precedence as ++.
& Address operator. Defined on variables. Same precedence as ++.
For debugging C++, GDB implements a use of ‘&’ beyond what is allowed in the
C++ language itself: you can use ‘&(&ref )’ (or, if you prefer, simply ‘&&ref’)
to examine the address where a C++ reference variable (declared with ‘&ref ’)
is stored.
- Negative. Defined on integral and floating-p oint types. Same precedence as ++.
! Logical negation. Defined on integral types. Same precedence as ++.
~ Bitwise complement operator. Defined on integral types. Same precedence as
++.
., -> Structure member, and pointer-to-structure member. For convenience, GDB
regards the two as equivalent, choosing whether to dereference a pointer based
on the stored type information. Defined on struct and union data.
.*, ->* Dereferences pointers to members.
[] Array indexing. a [i] is defined as *(a +i). Same precedence as ->.
() Function parameter list. Same precedence as ->.
:: C++ scope resolution operator. Defined on struct, union, and class types.
:: Double colons also represent the GDB scope operator (see Section 8.1 [Expres-
sions], page 63). Same precedence as ::, above.
If an operator is redefined in the user code, GDB usually attempts to invoke the redefined
version instead of using the original meaning.