diff options
| author | 2026-06-13 03:32:21 +0000 | |
|---|---|---|
| committer | 2026-06-13 04:59:51 +0000 | |
| commit | be63ecd9711b46135bbff1769c2e4c3642255ef1 (patch) | |
| tree | d5581c8b2e438af2b8ae82dd8f200393b2dbc5d3 /STYLE.md | |
| parent | TODO: Update (diff) | |
Unify lengths
Diffstat (limited to 'STYLE.md')
| -rw-r--r-- | STYLE.md | 17 |
1 files changed, 13 insertions, 4 deletions
@@ -22,12 +22,21 @@ the package's central type, `New`, `Close`, etc. Options structs should be close to `New`. There should not be an `options.go`. -## Sizes +## Sizes and offsets -Sizes are typically `uint64`. -Use `intconv` for conversions where necessary. +In-memory sizes and offsets are `int`. +They are bounded by `len()`, +and anything too large for `int` cannot be held in memory anyway. -**TODO:** revisit this and consider whether to make sizes `int`. +On-disk and wire-format fields stay `uint64`, +faithful to their serialized representation. +Convert at the boundary with `intconv`. + +Convert a value where it is stored or crosses into a domain, +not for a transient one: +a short-lived result can keep its producer's type, +widening the other operand at a comparison +rather than being narrowed to match. ## Comments |
