Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>Nifty Struct Layout: C/C++ Struct PaddingNew to Visual Studio Code? Get it now.
Nifty Struct Layout: C/C++ Struct Padding

Nifty Struct Layout: C/C++ Struct Padding

Nifty

| (0) | Free
See the memory layout of C and C++ structs: offsets, sizes, alignment and padding on hover and inline, a fix that reorders fields to save space, and hex, binary and char hovers for numbers.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Nifty Struct Layout

See the memory layout of C and C++ structs: offsets, sizes, alignment and padding on hover and inline, a fix that reorders fields to save space, and hex, binary and char hovers for numbers.

Maintained. No sign-in. No telemetry. Works in VS Code, Cursor, Windsurf, VSCodium and other editors that use Open VSX.

Features

Hovering a struct shows each field's offset and size and where the padding goes, with padding and sizes shown inline

The light bulb offers to reorder the fields of SensorReading to save 16 bytes

  • Struct layout on hover. Hover over a struct's name to see every field's offset and size, where padding goes and how much, and the total sizeof and alignment. Unions, typedef'd structs, nested structs, arrays, pointers, bit-fields, #pragma pack and __attribute__((packed)) are all handled.
  • Padding shown inline. Wasted bytes appear right in the struct definition (7B pad), with the struct's size after its closing brace. Switch to all to see every field's offset.
  • Make it smaller. When ordering the fields by alignment would save space, the struct name gets a hint and the light bulb offers Reorder fields of Header to save 16 bytes.
  • Pick your platform. Sizes and alignment follow the ABI you target: 64-bit Linux/macOS, 64-bit Windows (where long is 4 bytes), 32-bit x86 or 32-bit ARM.
  • Numbers in every base. Hover over a number literal to see it in hex, decimal, binary (grouped by 4 bits) and as a character. Digit separators and suffixes (1'000'000ULL) work.
  • Works on the source text, alongside the C/C++ extension or clangd. Nothing to compile.
  • Works in the browser on vscode.dev and github.dev.

Commands

Command What it does
Nifty Struct Layout: Choose Target ABI… Pick the platform to lay structs out for

Settings

Setting Default What it does
nifty.struct-layout.abi auto lp64, llp64, ilp32-x86, ilp32-arm, or match this computer
nifty.struct-layout.inlayHints padding padding (padding and sizes), all (every field's offset), or off
nifty.struct-layout.wasteThreshold 4 Suggest reordering when it saves at least this many bytes
nifty.struct-layout.numberHover true Show numbers in other bases on hover

Types from headers the extension can't see (for example a struct defined in another file) are reported as unknown rather than guessed.

Install

  • VS Code: search for "Nifty Struct Layout" in the Extensions view, or install from the Visual Studio Marketplace.
  • Cursor, Windsurf, VSCodium, Kiro, Antigravity: install from Open VSX.

Privacy

This extension collects no telemetry and needs no account.

More Nifty tools

  • Nifty Code Runner: Run Code in 25+ Languages: Run the current file or selection in 25+ languages in the terminal, with input support, your own commands and no telemetry. (Open VSX)
  • Nifty Colors: Swatches & Picker in Every Language: Colour swatches and VS Code's picker in any file: CSS, Tailwind, Flutter, Swift, Android, C# and Unity colours. Convert formats and check WCAG contrast on hover. (Open VSX)
  • Nifty CSS Variables: Custom Property IntelliSense: IntelliSense for CSS custom properties across your project: complete var(--…), see resolved values and colour swatches, go to definitions, catch undefined variables, and browse a colour palette. (Open VSX)
  • Nifty Diagrams: PlantUML, Graphviz & D2 Preview: PlantUML, Graphviz (DOT) and D2 diagrams rendered on your machine: live preview beside the editor, SVG and PNG export, diagrams in the Markdown preview, errors in Problems. No server needed. (Open VSX)
  • Nifty Mermaid: Mermaid Diagram Preview & Export: Mermaid diagrams with no account: live preview beside .mmd files and Markdown, diagrams in the Markdown preview, syntax highlighting, and export to SVG or PNG. (Open VSX)
  • Nifty Monitor: CPU & Memory in the Status Bar: CPU, memory and disk usage in the status bar, including on remote SSH machines and dev containers. (Open VSX)

See all 100+ Nifty extensions and web tools at https://getnifty.dev

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft