ID Number: Q73309
6.00 6.00a 6.00ax | 6.00 6.00a
MS-DOS | OS/2
buglist6.00 buglist6.00a buglist6.00ax fixlist7.00
Summary:
SYMPTOMS
The Microsoft C Compiler versions 6.0, 6.0a, and 6.0ax may
incorrectly evaluate the __TIMESTAMP__ predefined macro, which is
designed to give the date and time of the last modification of the
source file where the macro is used. The problem occurs when
__TIMESTAMP__ is used in both a header file and a source file that
includes that header file, because both occurrences of the macro
are then incorrectly evaluated to the same timestamp.
STATUS
Microsoft has confirmed this to be a problem in C versions 6.0,
6.0a, and 6.0ax. This problem was corrected in C/C++ version 7.0.
More Information:
The macro __TIMESTAMP__ evaluates to the date and time of the last
modification of the source file, expressed as a string literal in the
following form:
Ddd Mmm [d]d hh:mm:ss yyyy
When included in a header file, __TIMESTAMP__ evaluates correctly for
that file. When included in a C source module, __TIMESTAMP__ evaluates
correctly for that file as well; however, when the header file is
included in the source module, both occurrences of the macro evaluate
to the timestamp expansion that is encountered first.
The sample code below illustrates this problem. __TIMESTAMP__ is in
both the header file TMSTAMP.H and in the source file TMSTAMP.C that
includes TMSTAMP.H. The following sample output shows that the time
stamp actually displayed in both cases is that of the header file,
because it occurs first:
Module timestamp is Tue Jun 11 11:44:09 1991
Header timestamp is Tue Jun 11 11:44:09 1991
Placing the #include line for TMSTAMP.H after the declaration of
m_timestamp results in both timestamps displaying as that of the
TMSTAMP.C module. The following output from the C version 5.1 compiler
shows correct timestamps for each file.
Module timestamp is Tue Jun 11 11:47:48 1991
Header timestamp is Tue Jun 11 11:44:18 1991
Sample Code
-----------
TMSTAMP.H
---------
unsigned char h_timestamp[] = __TIMESTAMP__;
TMSTAMP.C
---------
/* Compile options needed: none
*/
#include <stdio.h>
#include "tmstamp.h"
unsigned char m_timestamp[] = __TIMESTAMP__;
void main( )
{
printf( "Module timestamp is %s\n", m_timestamp );
printf( "Header timestamp is %s\n", h_timestamp );
}
Additional reference words: _timestamp _timestamp_ __timestamp 6.00
6.00a 6.00ax