Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>VisualStruct SizeNew to Visual Studio Code? Get it now.
VisualStruct Size

VisualStruct Size

Funny Paradox

|
5 installs
| (0) | Free
Shows compiler-measured C struct sizes inline next to struct names.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

VisualStruct Size

VisualStruct Size shows compiler-measured C and C++ struct sizes directly in the editor, next to the struct name.

typedef struct
{
	uint16_t width;
	uint16_t height;
	uint32_t flags;
}
texture_header_t;  8 B

The extension does not estimate layout with a custom parser. It asks your configured C/C++ compiler to compile and run a tiny local probe, so the displayed size includes the padding, alignment, ABI rules, and platform-specific type sizes used by your project.

Features

  • Inline size decorations for C and C++ struct declarations.
  • Compiler-measured results using your local toolchain.
  • Support for typedef structs and tagged structs.
  • Automatic refresh after edits.
  • Manual refresh command: VisualStruct Size: Refresh.
  • Readable units for larger structs.

Size formatting stays in the current unit until the value is above 9999:

9999 B      -> 9999 B
10000 B     -> 10 KB (10000 B)
1024000 B   -> 1024 KB (1024000 B)
10240000 B  -> 10.2 MB (10240000 B)

For values above 9999 B, the exact byte count is kept in parentheses.

Requirements

VisualStruct Size requires:

  • Visual Studio Code 1.85.0 or newer.
  • A local C/C++ compiler available from VS Code.
  • A trusted local workspace.

The extension compiles and runs a temporary probe executable in your workspace to measure struct sizes. For that reason, it is disabled in untrusted and virtual workspaces.

Extension Settings

VisualStruct Size can reuse settings from the Microsoft C/C++ extension:

  • C_Cpp.default.compilerPath
  • C_Cpp.default.compilerArgs
  • C_Cpp.default.includePath

You can also configure VisualStruct Size directly:

{
	"visualStructSize.compilerPath": "C:/msys64/mingw64/bin/gcc.exe",
	"visualStructSize.compilerArgs": ["-std=gnu23"],
	"visualStructSize.includePaths": ["${workspaceFolder}", "C:/raylib/library"],
	"visualStructSize.extraCompilerArgs": [],
	"visualStructSize.debounceMs": 700,
	"visualStructSize.timeoutMs": 5000
}

Available settings:

Setting Description
visualStructSize.enabled Enables or disables inline size decorations.
visualStructSize.compilerPath Compiler used to measure sizes. Empty falls back to C_Cpp.default.compilerPath, then gcc.
visualStructSize.compilerArgs Compiler arguments used before include paths. Empty falls back to C_Cpp.default.compilerArgs, then -std=gnu23.
visualStructSize.includePaths Include paths passed with -I. Empty falls back to C_Cpp.default.includePath, then ${workspaceFolder}.
visualStructSize.extraCompilerArgs Additional compiler arguments appended after include paths.
visualStructSize.debounceMs Delay before re-measuring after edits.
visualStructSize.timeoutMs Compiler and probe execution timeout.

How It Works

When a C or C++ file is active, VisualStruct Size:

  1. Finds struct declarations in the editor.
  2. Writes a temporary header and probe source file under .temp/vscode-visualstruct-size.
  3. Compiles the probe with the configured compiler and include paths.
  4. Runs the probe locally.
  5. Displays each measured sizeof(...) result inline.

Limitations

  • Structs must be compilable with the configured compiler settings.
  • Generated probe files are temporary, but the active file must still be valid enough to include in a C/C++ probe.
  • Complex macro-generated structs may not be detected by the lightweight scanner.
  • If a source file depends on build-system-only defines or include paths, add them through visualStructSize.compilerArgs, visualStructSize.extraCompilerArgs, or visualStructSize.includePaths.

Troubleshooting

If sizes do not appear, run VisualStruct Size: Refresh from the Command Palette.

If measurement fails, open Output > VisualStruct Size. The output includes the compiler command and compiler error so you can adjust include paths, defines, or compiler arguments.

Common fixes:

  • Set visualStructSize.compilerPath to the compiler used by your project.
  • Add missing include directories to visualStructSize.includePaths.
  • Add required defines such as -DDEBUG or -DPLATFORM_WINDOWS to visualStructSize.extraCompilerArgs.

Release Notes

1.0.0

Initial release.

License

0BSD. You can use, copy, modify, and redistribute it for any purpose.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft