---
title: "Index, Count, Offset, Size"
description: "TigerBeetle uses a strict naming convention to catch off-by-one and index-space bugs that types don't easily prevent: `count` is a number of items, `index` points at an item (invariant `index < count`), `size` is a byte count (`size = @sizeOf(T) * count`), and `offset` is the bytewise counterpart of index. `length` is banned because it is ambiguous, for example Rust's byte-size `str::len` versus Python's code-point `len`."
url: "https://swe.quest/articles/index-count-offset-size-8c9106813a691acc"
canonical: "https://tigerbeetle.com/blog/2026-02-16-index-count-offset-size"
source: "TigerBeetle"
published: "2026-02-16"
difficulty: "medium"
kind: "Opinion"
reading_minutes: 3
tags: ["zig","debugging","type-systems"]
---

# Index, Count, Offset, Size

A post on [TigerBeetle](https://swe.quest/sources/tigerbeetle.md), published 2026-02-16, 3 min read, Opinion. Original: [https://tigerbeetle.com/blog/2026-02-16-index-count-offset-size](https://tigerbeetle.com/blog/2026-02-16-index-count-offset-size)

## Summary

TigerBeetle uses a strict naming convention to catch off-by-one and index-space bugs that types don't easily prevent: \`count\` is a number of items, \`index\` points at an item (invariant \`index \< count\`), \`size\` is a byte count (\`size = @sizeOf(T) \* count\`), and \`offset\` is the bytewise counterpart of index. \`length\` is banned because it is ambiguous, for example Rust's byte-size \`str::len\` versus Python's code-point \`len\`. Zig examples from NodePool and an EWAH decoder show wrong combinations becoming visible from names alone. The convention works together with big-endian naming (qualifiers as suffixes) and equal-length dual names like source/target, which line code up so mistakes stand out.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Zig](https://swe.quest/tags/zig.md) (Languages)
- [Debugging](https://swe.quest/tags/debugging.md) (Engineering practices)
- [Type systems](https://swe.quest/tags/type-systems.md) (Compilers & runtimes)

## Prerequisites

- array indexing
- pointer arithmetic basics

## Keywords

TigerBeetle, TigerStyle, Zig, EWAH, NodePool

## Related posts

- [Swarm Testing Data Structures](https://swe.quest/articles/swarm-testing-data-structures-dcd11950dc8316b7.md): TigerBeetle · 2025-04-23 · Medium · 5 min read · Testing, Zig, Data structures
  Zig's comptime reflection (std.meta.DeclEnum) can turn a data structure's public API into an enum that drives a model-based property test, so adding a new public method triggers a compile error from the non-exhaustive switch until the test covers it.
- [Synadia and TigerBeetle Pledge $512,000 to the Zig Software Foundation](https://swe.quest/articles/synadia-and-tigerbeetle-pledge-512-000-to-the-zig-software-foundation-124e30142ae18e3c.md): TigerBeetle · 2025-10-25 · Easy · 8 min read · Zig, Language design, Memory safety, Open source
  Synadia and TigerBeetle are jointly donating $512,000 to the Zig Software Foundation over two years, with no strings attached.
- [Bun v1.1.7](https://swe.quest/articles/bun-v1-1-7-443b16215b4eb538.md): Bun · 2024-05-03 · Medium · 7 min read · JavaScript, Runtimes & VMs, Debugging
  Bun v1.1.7 fixes 28 bugs and adds glob patterns in package.json workspaces (via Bun.Glob), asymmetric matcher support in expect.extend's this.equals, and a working bunx --version.
- [Copy Hunting](https://swe.quest/articles/copy-hunting-7c2f19f97f1f7edc.md): TigerBeetle · 2023-07-26 · Medium · 11 min read · Zig, Compilers, Performance engineering, Debugging, Developer tools
  Reading Zig's emitted LLVM IR as plain text and grepping it is a practical substitute for staring at disassembly when chasing implicit memcopies and binary bloat.
- [Bun v1.2.1](https://swe.quest/articles/bun-v1-2-1-aab3e8d9e0004536.md): Bun · 2025-01-27 · Medium · 7 min read · JavaScript, Runtimes & VMs, Memory management, Zig
  Bun v1.2.1 fixes 32 bugs and adds S3 storage class support, X25519 key generation in crypto.generateKeyPair, Node's --zero-fill-buffers flag, indented inline snapshots in bun test, and a bunfig option to disable minification for HTML imports.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
