第一次(在我的新开发环境中)我看到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: ???
答案 0 :(得分:5)
对于遇到此问题的其他人......
结构由strptime填充,显然没有填充未使用的结构成员(dst)......但是mktime不喜欢这个:)所以将它设置为零