liveBook · Manning

Underlying type

An underlying type is the type that determines a named type’s representation, foundational values, or permitted operations.

How 2 Manning books explain it

Modern C, Third Edition

An underlying type is the integer type used to represent the values of a C enumeration.

How it is used
Clarifies how C enumerations represent constants and when portability requires an explicit integer type.
How deep it goes
Explains automatic adjustment, signedness variation, impossible ranges, and C23 syntax, while deferring deeper typeof treatment.
Examples
Uses wide, narrow, ambiguous large, and explicitly typed eInt, eSig, and e32 enumerations.
What you can do after
Evaluate enumeration definitions for portability and specify an underlying type when values or signedness could vary.

Read how Modern C, Third Edition explains underlying type →

100 Go Mistakes and How to Avoid Them

An underlying type is the type that determines the representation and core identity shared by a defined Go type and its underlying type.

How it is used
Distinguishes exact type constraints from constraints accepting defined types with a shared underlying type.
How deep it goes
Explains the difference between int and ~int through a custom type and a compilation failure.
Examples
Uses customInt, a String method, and constraints containing ~int or int.
What you can do after
Evaluate generic constraints and choose ~T when defined types sharing T's underlying type should be accepted.

Read how 100 Go Mistakes and How to Avoid Them explains underlying type →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.