liveBook · Manning

Int64

As explained in Go in Action, Second Edition

int64 is Go's signed integer type that represents values using exactly 64 bits.

int64 is Go’s signed integer type with exactly 64 bits. It is the largest native integer type and suits values requiring the greatest range, including timestamps, file offsets, and size limits. section 3.1.1

Choose int64 when its range or API compatibility justifies it:

  • Use it for values passed frequently to functions that accept int64. section 3.1.1
  • Prefer int for general-purpose integers unless the domain requires int64; convert from int when needed. section 3.1.1
  • Avoid choosing smaller integer types merely to save memory; benchmark and profile before treating representation size as a performance problem. section 3.1.1

How Go in Action, Second Edition covers it

How deep it goes
Explains range-oriented selection and conversion trade-offs, but does not develop int64’s internal representation.
Examples
Uses timestamps, file offsets, size limits, and compatibility with functions accepting int64 as practical examples.
What you can do after
Evaluate integer-type choices and select int64 when range or API compatibility requires it.
How it connects
Connects int64 with int, signed integers, integer conversions, standard-library APIs, timestamps, file offsets, and size limits.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Go in Action, Second Edition. The section links point to the parts of the book it draws on.