Exporter (0) Imprimer
Développer tout
Cet article a fait l'objet d'une traduction automatique. Déplacez votre pointeur sur les phrases de l'article pour voir la version originale de ce texte. Informations supplémentaires.
Traduction
Source

SafeInt, fonctions

The SafeInt library provides several functions that you can use without creating an instance of the SafeInt, classe. If you want to protect a single mathematical operation from integer overflow, you can use these functions. If you want to protect multiple mathematical operations, you should create SafeInt objects. It is more efficient to create SafeInt objects than to use these functions multiple times.

These functions enable you to compare or perform mathematical operations on two different types of parameters without having to convert them to the same type first.

Each of these functions has two template types: T and U. Each of these types can be a Boolean, character, or integral type. Integral types can be signed or unsigned and any size from 8 bits to 64 bits.

Fonction

Description

SafeAdd

Adds two numbers and protects against overflow.

SafeCast

Casts one type of parameter to another type.

SafeDivide

Divides two numbers and protects against dividing by zero.

SafeEquals , SafeGreaterThan, SafeGreaterThanEquals, SafeLessThan, SafeLessThanEquals, SafeNotEquals

Compares two numbers. These functions enable you to compare two different types of numbers without changing their types.

SafeModulus

Performs the modulus operation on two numbers.

SafeMultiply

Multiplies two numbers together and protects against overflow.

SafeSubtract

Subtracts two numbers and protects against overflow.

Section

Description

SafeInt, classe

Classe SafeInt.

SafeIntException, classe

The exception class specific to the SafeInt library.

Ajouts de la communauté

AJOUTER
Afficher:
© 2014 Microsoft