CodeQL library for C/C++
Search

Module ArithmeticOperation

Provides classes for modeling arithmetic operations such as +, -, * and ++.

Import path

import semmle.code.cpp.exprs.ArithmeticOperation

Imports

Expr

Provides classes modeling C/C++ expressions.

Classes

AddExpr

A C/C++ add expression. c = a + b;

BinaryArithmeticOperation

A C/C++ binary arithmetic operation.

ConjugationExpr

A C/C++ GNU conjugation expression. It operates on _Complex or __complex__numbers, and is similar to the C99 conj, conjf and conjl functions. _Complex double a = ( 1.0, 2.0 ); _Complex double b = ~ a; // ( 1.0, - 2.0 )

CrementOperation

A C/C++ ++ or -- expression (either prefix or postfix).

DecrementOperation

A C/C++ -- expression (either prefix or postfix).

DivExpr

A C/C++ divide expression. c = a / b;

ImaginaryDivExpr

A C/C++ divide expression with an imaginary number. This is specific to C99 and later. double z; _Imaginary double y; z = z / y;

ImaginaryMulExpr

A C/C++ multiply expression with an imaginary number. This is specific to C99 and later. double z; _Imaginary double x, y; z = x * y;

ImaginaryPartExpr

A C/C++ GNU imaginary part expression. It operates on _Complex or __complex__ numbers. _Complex double f = { 2.0, 3.0 }; double d = __imag(f); // 3.0

ImaginaryRealAddExpr

A C/C++ add expression with an imaginary term and a real term. This is specific to C99 and later. double z; _Imaginary double x; _Complex double w; w = x + z;

ImaginaryRealSubExpr

A C/C++ subtract expression with an imaginary term and a real term. This is specific to C99 and later. double z; _Imaginary double x; _Complex double w; w = x - z;

IncrementOperation

A C/C++ ++ expression (either prefix or postfix).

MaxExpr

A C/C++ GNU max expression. c = a >? b;

MinExpr

A C/C++ GNU min expression. c = a <? b;

MulExpr

A C/C++ multiply expression. c = a * b;

PointerAddExpr

A C/C++ pointer add expression. foo *ptr = &f[0]; ptr = ptr + 2;

PointerArithmeticOperation

A C/C++ pointer arithmetic operation.

PointerDiffExpr

A C/C++ pointer difference expression. foo *start = &f[0], *end = &f[4]; int size = end - size;

PointerSubExpr

A C/C++ pointer subtract expression. foo *ptr = &f[3]; ptr = ptr - 2;

PostfixCrementOperation

A C/C++ ++ or -- postfix expression.

PostfixDecrExpr

A C/C++ postfix decrement expression, as in x--.

PostfixIncrExpr

A C/C++ postfix increment expression, as in x++.

PrefixCrementOperation

A C/C++ ++ or -- prefix expression.

PrefixDecrExpr

A C/C++ prefix decrement expression, as in --x.

PrefixIncrExpr

A C/C++ prefix increment expression, as in ++x.

RealImaginaryAddExpr

A C/C++ add expression with a real term and an imaginary term. This is specific to C99 and later. double z; _Imaginary double x; _Complex double w; w = z + x;

RealImaginarySubExpr

A C/C++ subtract expression with a real term and an imaginary term. This is specific to C99 and later. double z; _Imaginary double x; _Complex double w; w = z - x;

RealPartExpr

A C/C++ GNU real part expression. It operates on _Complex or __complex__ numbers. _Complex double f = { 2.0, 3.0 }; double d = __real(f); // 2.0

RemExpr

A C/C++ remainder expression. c = a % b;

SubExpr

A C/C++ subtract expression. c = a - b;

UnaryArithmeticOperation

A C/C++ unary arithmetic operation.

UnaryMinusExpr

A C/C++ unary minus expression. b = - a;

UnaryPlusExpr

A C/C++ unary plus expression. b = + a;