---
name: "GD_SIZE"
section: "3"
platform: "linux"
package: "libgetdata-doc"
version: "0.11.0-15"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/GD_SIZE"
---

# GD\_SIZE(3)

report the size of a GetData data sample

## NAME

GD\_SIZE — report the size of a GetData data sample

## SYNOPSIS

**#include \<getdata.h\>**

**int GD\_SIZE(gd\_type\_t** *type***);**

## DESCRIPTION

The **GD\_SIZE**() preprocessor macro returns the size in bytes of a single sample of data of the type specified by *type*, which should be one of the symbols:

-

  **GD\_NULL**, **GD\_UINT8**, **GD\_INT8**, **GD\_UINT16**, **GD\_INT16**, **GD\_UINT32**, **GD\_INT32**, **GD\_FLOAT32**, **GD\_FLOAT64**, **GD\_COMPLEX64**, **GD\_COMPLEX128**, **GD\_STRING**, **GD\_UNKNOWN**.

Passing **GD\_NULL** or **GD\_UNKNOWN** to this macro will return zero.  Passing **GD\_STRING** will return **sizeof(const char\*)**. For the other types, the value returned is simply the bit-size encoded in the type symbol divided by eight, so, e.g., **GD\_SIZE(GD\_COMPLEX64)** will return 8.

No error checking is performed on *type*: behaviour resulting from passing something other than the symbols listed above to this macro is unspecified. See [**gd\_getdata**(3)](/gd_getdata/3.md) for the meaning of the above symbols.

## HISTORY

The **GD\_SIZE**() macro appeared in GetData-0.3.0

## SEE ALSO

[**gd\_getdata**(3)](/gd_getdata/3.md)
