第一次(在我的新开发环境中),我看到valgrind抱怨mktime,但是我不确定这是libc库,valgrind还是我的代码中的错误。我将从错误开始(如下)-这个信息足以解释原因吗?
==3682== at 0x38ACE9A505: __mktime_internal (in /lib64/libc-2.12.so)
==3682== by 0x4D66F7: ???
==3682== by 0x4D7611: ???
==3682== by 0x4D23CD: ???
==3682== by 0x4D175B: ???
==3682== by 0x38ACE1ECDC: (below main) (in /lib64/libc-2.12.so)
==3682== Uninitialised value was created by a stack allocation
==3682== at 0x4D64BE: ???
==3682==
==3682== Conditional jump or move depends on uninitialised value(s)
==3682== at 0x38ACE9A505: __mktime_internal (in /lib64/libc-2.12.so)
==3682== by 0x4D67DA: ???
==3682== by 0x4D7611: ???
==3682== by 0x4D23CD: ???
==3682== by 0x4D175B: ???
==3682== by 0x38ACE1ECDC: (below main) (in /lib64/libc-2.12.so)
==3682== Uninitialised value was created by a stack allocation
==3682== at 0x4D64BE: ???
最佳答案
对于遇到这个问题的任何人...
该结构由strptime填充,显然不填充未使用(dst)的结构成员...但是mktime不喜欢这样:)因此将其设置为零