Behavior of uninitialized local char?

前端 未结 3 1691
挽巷
挽巷 2021-01-19 06:31

If you have lets say a local int that is uninitialized, then its gets an undefined value but if you have a local char variable should that not have

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-19 06:58

    Uninitialised means really uninitialised. Just because you consistently get a particular value on your machine at a particular time, doesn't mean that will always be the case all the time on all machines.

    You can verify that nothing is initialising your variable by dumping the assembly code for your function and inspecting it.

提交回复
热议问题