On Fri, Mar 19, 2021 at 1:47 PM xie cui <cuiwei...@gmail.com> wrote:

> https://github.com/golang/go/blob/master/src/cmd/compile/internal/types2/universe.go#L58-L64
> there are some basic type call untyped xxx? what is it mean?

Untyped bool, int, etc are the types of untyped constants:
https://golang.org/ref/spec#Constants

> when will go compiler use them?

The compiler already uses them.

> can you show in example?

const i = 42 // i is untyped int
const j = int(42) // j is int

var f float64 = i // ok because i is untyped int
var g float64 = j // compile error, type mismatch

https://play.golang.org/p/pVZyvzLLSXM

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAA40n-WKopHiS0kL2_C3m9RqgjzKn0q%2BUNB1FK29PBfq%3D1CXwA%40mail.gmail.com.

Reply via email to