In the code below:
const (
signature uint32 = 0xae3179fb
dhkxGroup = 2
ReplySuccessful byte = iota
ReplyBufferCorrupted
ReplyDecryptFailed
ReplySessionExpired
ReplyPending
)
ReplySuccessful
is compiled to 2
, while I think it should definitly be ZERO. If I move signature
and dhkxGroup
below ReplyPending
, then ReplySuccessful
becomes 0.
Why is this?
PS. To me, the only "benefit" of using iota is that you can ommit the value assigned to later constants, so that you can easily modify/insert new values. However, if iota is not FIXED to zero, it could cause big problem especially in doing things like communication protocols.