uCalc API Version: 2.1.3-preview.2 Released: 6/17/2026

Warning

uCalc API Preview Release Notice:The documentation describes the intended behavior of the API. The current preview build contains incomplete features, unoptimized performance, and is subject to breaking changes.

ByteSize = [int]

Property

Product: 

Fast Math Parser

Class: 

DataType

Gets the size, in bytes, that a single value of this data type occupies in memory.

Remarks

The ByteSize method returns the number of bytes a single unit of this data type occupies in memory. This is essential for understanding memory layout, performing serialization, or interfacing with external native code that requires explicit size information.

Common Data Type Sizes

The following table shows the byte sizes for some of uCalc's common built-in types on a typical 64-bit system.

Data Type NameBuiltInType Enum MemberByteSizeNotes
32-bit IntegerInteger_324Standard integer size.
64-bit IntegerInteger_648Long integer.
DoubleFloat_Double8Default floating-point type.
BooleanBoolean4Typically aligned to an integer.
StringString8Size of the handle/pointer to the string data, not the character length.
PointerPointer8Size of a memory address.

Note on Dynamic Types: For compound or variable-length types like String, ByteSize returns the size of the internal handle or pointer, not the size of the allocated content. To get the number of characters in a string, use the Length() function.

⚖️ Comparative Analysis

  • vs. C++/C# sizeof(T): In C++ and C#, sizeof is a compile-time operator that returns the size of a type. uCalc's ByteSize() is a runtime method. This means you can dynamically query the size of a data type whose identity might not be known until the program is running, which is a key advantage for scripting and dynamic environments.

  • Utility: ByteSize is particularly useful when working with arrays or when binding uCalc variables to structured memory buffers in the host application. It allows you to perform pointer arithmetic and calculate memory offsets correctly based on uCalc's internal type system.

Examples