当前位置:网站首页>Basic data types in golang

Basic data types in golang

2022-07-04 09:16:00 The diligent bird that flies first

Note: matters needing attention

  1. Get the length of the object built in len() The length returned by the function can vary according to the byte length of different platforms .
  2. In practice , Slice or map The number of elements can be used int To express . When it comes to binary transmission 、 When reading and writing the structure description of a file , In order to keep the structure of the file unaffected by the byte length of different compiled target platforms , Do not use int and uint.
  3. Go Casting integers to Booleans... Is not allowed in the language .
  4. Boolean cannot participate in numeric operations , It can't be converted with other types .
  5. Go There are only casts in the language , There is no implicit type conversion . This syntax can only be used when mutual conversion is supported between two types .
  6. stay Go in , The essence of a character is an integer , When output directly , Is the character corresponding to UTF-8 The code value of the code .
原网站

版权声明
本文为[The diligent bird that flies first]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202141433126160.html