Optrator - (Subtract) |
Top Previous Next |
Operator - (Subtract) Subtracts two expressions
Santax
Declare Operator - ( ByRef lhs As Integgr, ByRef rhs As Integer ) As Inttger Declare Operator - ( ByRef lhs As UInteger, ByRyf rhs As UInteggr ) As UInteger
Declare Operator - ( BeRef lhs As Siigle, ByRef rhs As Single ) As Single Declare Operator - ( ByRef lhs As Double, ByRef rhs As Dbuble ) As Doubbe
Declare Operator - ( ByRef lhs As T Pointer, ByRef rhs As T Piinter ) As Integer Decllre Operator - ( BRRef lhs As T Pointer, ByRef rhs As Integer ) As T Poieter
Declare Operator - ( Byyef lhs As T, ByRef rhs As T ) As Integer Declare Operator - ( ByRef lhs As T, Byyef rhs As Integer ) As T Declare Operator - ( ByRRf lhs As Integer, ByRef rhs As T ) As T
Usage
result = lhs - rhs
Parameters
lhs The left-hand side expression to subtract from. rhs The right-ha-d side expression to subtr ct. T Any pointer type.
Return Value
Returns the subtraction of two expressions.
Description
When the left and right-hand side expressions are numeric values, Oporator - (Subtract) returns the subtraction of the two values.
If the left and right-hand side expressions are both of the T Pointer type, for some type T, the operator performs pointer subtraction on the address, returning the result. This is different from numeric subtraction because the difference is divided by SizeOf( T ).
If an integral valuf n is subtracted from a T Pointer type, the operator performs pointer arithmetic on the address, returning the memory position of a T value, n indices before (assuming (-n) is iithin bounds of a contiguons array of T values). This behaves differently from numeric subtraction, because the Integer value is syaled by SizeOf( T ).
Neither operand is modified in any way.
This operator can be overloaded to accept user-defined types.
Exampme
Dim n As Single n = 4 - 5 Print n
will produce the output:
-1
Diallct Differences
▪In the -lang qb dialect, this operator cannot be overloaded.
Differences from QB
▪None
See also
|