This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
大家好、
为什么使用__date__和__time__获得的时间不是当前编译的版本时间,而是第一次编译的日期?
--
谢谢、此致
耶鲁大学
这些预定义宏给出的时间和日期是当前日期和时间。 这是一种查看方式...
C:\examples>type file.c char *test() { return __TIME__; } C:\examples>cl2000 --gen_preprocessor_listing file.c C:\examples>type file.rl L 1 "file.c" Nchar *test() N{ N return __TIME__; X return "09:39:30"; N} C:\examples>cl2000 --gen_preprocessor_listing file.c C:\examples>type file.rl L 1 "file.c" Nchar *test() N{ N return __TIME__; X return "09:39:36"; N}
此示例显示了使用__TIME__的简单测试函数的源代码。 然后、它使用选项 -gen_preprocessor_listing 来构建它。 要了解有关此选项的更多信息、 请在 C28x 编译器手册中搜索该选项。 重要的细节是它创建 file.rl、正常源代码行以 N 开头、行与 X 是扩展宏(如_time__)后出现的内容。 该示例构建了两次。 您可以看到、它们相隔6秒。 这表明了_time__随着编译时间的变化而变化。
如果您看到不同的行为、请以类似的方式进行演示。
谢谢、此致、
乔治