简体   繁体   English

ANSI C:__DATE__和__TIME__字符串的大小的标准定义?

[英]ANSI C: standard definition for the size of the __DATE__ and __TIME__ strings?

Is there a standard definition for the size of the __DATE__ and __TIME__ strings in ANSI C? ANSI C中的__DATE__和__TIME__字符串的大小是否有标准定义?

The motivation behind this question is: 这个问题背后的动机是:

  • I have two applications running on two different CPUs. 我有两个运行在两个不同CPU上的应用程序。

  • During runtime, app #1 receives date and time (as part of version-info) from app #2. 在运行时,应用程序1从应用程序2接收日期和时间(作为版本信息的一部分)。

  • Of course, app #2 takes them from the preprocessor __DATE__ and __TIME__ definitions. 当然,应用程序2从预处理器__DATE__和__TIME__定义中获取它们。

So I would like to know whether or not I can statically allocate in app #1 an array, into which I can copy the info received from app #2. 因此,我想知道是否可以在应用程序#1中静态分配一个数组,我可以将从应用程序#2接收到的信息复制到该数组中。

Thanks 谢谢

__DATE__

The date of translation of the source file (a character string literal of the form "Mmm dd yyyy", where the names of the months are the same as those generated by the asctime function, and the first character of dd is a space character if the value is less than 10). 源文件的翻译日期(格式为“ Mmm dd yyyy”的字符串文字,其中月份的名称与asctime函数生成的名称相同,并且dd的第一个字符是空格字符,如果该值小于10)。 If the date of translation is not available, an implementation-defined valid date shall be supplied. 如果翻译日期不可用,则应提供实施定义的有效日期。

__TIME__

The time of translation of the source file (a character string literal of the form "hh:mm:ss" as in the time generated by the asctime function). 源文件的翻译时间(与asctime函数生成的时间一样,格式为“ hh:mm:ss”的字符串文字)。 If the time of translation is not available, an implementation-defined valid time shall be supplied. 如果翻译时间不可用,则应提供实施定义的有效时间。

ISO/IEC 9899:2011, §6.10.8.1 Mandatory macros ISO / IEC 9899:2011,§6.10.8.1强制宏

__DATE__ The date of translation of the preprocessing translation unit: a character string literal of the form "Mmm dd yyyy", where the names of the months are the same as those generated by the asctime function, and the first character of dd is a space character if the value is less than 10. If the date of translation is not available, an implementation-defined valid date shall be supplied. __DATE__预处理翻译单元的翻译日期:格式为“ Mmm dd yyyy”的字符串文字,其中月份的名称与asctime函数生成的名称相同,并且dd的第一个字符为空格如果值小于10,则为字符。如果没有翻译日期,则应提供实施定义的有效日期。

__TIME__ The time of translation of the preprocessing translation unit: a character string literal of the form "hh:mm:ss" as in the time generated by the asctime function. __TIME__预处理翻译单元的翻译时间:一个字符串文字,形式为“ hh:mm:ss”,与asctime函数生成的时间相同。 If the time of translation is not available, an implementation-defined valid time shall be supplied. 如果翻译时间不可用,则应提供实施定义的有效时间。

It is very straight-forward, therefore. 因此,这非常简单。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM