官术网_书友最值得收藏!

Defining the variable value before use

While it is not enforced in some languages, a variable must have an initial value in Rust, even if it is zero. This is good practice, and also helps when it comes to debugging since all variables have known contents. If they didn't, there'd be a risk of undefined behavior.

Undefined behavior means that what the program does is anyone's guess. For instance, if variables did not have initial values, their values would be whatever happens to be in memory at the time that the value is allocated.

主站蜘蛛池模板: 左云县| 政和县| 英吉沙县| 同德县| 乾安县| 博白县| 克东县| 连江县| 洪雅县| 增城市| 庆安县| 龙游县| 铁岭县| 庐江县| 抚松县| 屏边| 渭南市| 双牌县| 开封县| 大宁县| 伊宁市| 砀山县| 平阳县| 绿春县| 公主岭市| 南宫市| 邹城市| 石门县| 水城县| 青浦区| 松阳县| 雅江县| 临城县| 厦门市| 兴业县| 罗甸县| 通海县| 正蓝旗| 蕲春县| 阆中市| 江川县|