dbDefs.h

Miscellaneous macro definitions.

This file defines several miscellaneous macros.

Author

Marty Kraimer

Defines

TRUE
FALSE
LOCAL

Deprecated synonym for static.

NELEMENTS(array)

Number of elements in array.

OFFSET(structure, member)

Deprecated synonym for offsetof.

CONTAINER(ptr, structure, member)

Find parent object from a member pointer.

Subtracts the byte offset of the member in the structure from the pointer to the member itself, giving a pointer to parent structure.

Note

Both GCC and Clang will type-check this macro.

Parameters:
  • ptr – Pointer to a member data field of a structure

  • structure – Type name of the parent structure

  • member – Field name of the data member

Returns:

Pointer to the parent structure

PVNAME_STRINGSZ

Size of a record name including the nil terminator.

PVNAME_SZ

Size of a record name without the nil terminator.

Buffer size for the string representation of a DBF_*LINK field.

DB_MAX_CHOICES

dbAccess enums/menus can have up to this many choices