4

第一次(在我的新开发环境中)我看到 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: ???
4

1 回答 1

5

对于遇到这种情况的其他人...

该结构由 strptime 填充,它显然没有填充未使用的结构成员(dst)......但 mktime 不喜欢这样:) 所以 memset 它为零

于 2012-01-28T01:51:43.140 回答