Skip to content
Paul Squires edited this page Oct 19, 2026 · 2 revisions

Home › Converting Data Types › CSign

CSign

Converts an unsigned value to signed, so division and shifts treat it as signed.

Syntax

CSign ( expression )

Description

Converts an unsigned expression to a signed one, useful to force signed behavior of division or multiplication (including with Shl and Shr).

This is the opposite of CUnsg.

Remarks

Usage

variable = CSign ( expression )

Dialect Differences

  • Not available in the -lang qb dialect unless referenced with the alias __Csign.

Differences from QB

  • New to FreeBASIC

See also

Examples

Dim value As UShort = 65535

Print CSign(value)  '' will print -1

Category: Converting Data Types
Kind: keyword


Reproduced from the FreeBASIC Wiki Manual under the GNU Free Documentation License 1.3 — with no Invariant Sections, no Front-Cover Texts and no Back-Cover Texts. Copyright © the FreeBASIC project and wiki contributors. See License.

Clone this wiki locally