ANSI C:__DATE__ 和 __TIME__ 字符串大小的标准定义? [英] ANSI C: standard definition for the size of the __DATE__ and __TIME__ strings?

查看:25
本文介绍了ANSI C:__DATE__ 和 __TIME__ 字符串大小的标准定义?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

ANSI C 中 __DATE__ 和 __TIME__ 字符串的大小是否有标准定义?

Is there a standard definition for the size of the __DATE__ and __TIME__ strings in ANSI C?

这个问题背后的动机是:

The motivation behind this question is:

  • 我有两个应用程序在两个不同的 CPU 上运行.

  • I have two applications running on two different CPUs.

在运行时,应用 #1 从应用 #2 接收日期和时间(作为版本信息的一部分).

During runtime, app #1 receives date and time (as part of version-info) from app #2.

当然,应用 #2 从预处理器 __DATE__ 和 __TIME__ 定义中获取它们.

Of course, app #2 takes them from the preprocessor __DATE__ and __TIME__ definitions.

所以我想知道我是否可以在应用程序 #1 中静态分配一个数组,我可以将从应用程序 #2 收到的信息复制到其中.

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.

谢谢

推荐答案

__DATE__

源文件的翻译日期(一个字符串Mmm dd yyyy"形式的文字,其中月份的名称与 asctime 函数生成的相同,并且如果值小于 dd 的第一个字符是空格字符比 10).如果翻译日期不可用,应提供实现定义的有效日期.

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). If the date of translation is not available, an implementation-defined valid date shall be supplied.

__TIME__

源文件的翻译时间(一个字符串hh:mm:ss"形式的文字,如由asctime 函数).如果翻译时间不可用,应提供实现定义的有效时间.

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). If the time of translation is not available, an implementation-defined valid time shall be supplied.

这篇关于ANSI C:__DATE__ 和 __TIME__ 字符串大小的标准定义?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆