Expression explanation

What does it mean and what for in panic.go

*(*int)(nil) = 0 // not reached

(nil) is the default value of any type of “pointer” (channels, slices, pointer to struct…). So (*int)(nil) is a type casting forcing nil to be default value for the integer pointer. Finally * dereferences the pointer and assign 0 to the location pointed.
Can You post the context of this line of code?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.