4 messages in com.perforce.perforce-user[p4] Perforce keyword expansion
FromSent OnAttachments
Schlueter, Michael04 Dec 2001 04:26.bin
Arnt Gulbrandsen04 Dec 2001 05:03 
Peter Jaeckel04 Dec 2001 06:48 
twardst04 Dec 2001 06:57 
Subject:[p4] Perforce keyword expansion
From:Arnt Gulbrandsen (ar@gulbrandsen.priv.no)
Date:12/04/2001 05:03:02 AM
List:com.perforce.perforce-user

"Schlueter, Michael" <Schlueter at secunet.de>

Hi, I just found out that the perforce keyword expansion even replaces the keywords normal c++ constant strings. It took me quite while to find out that somewhere in a parser syntax definition a $date$ was replaced by the current date. Is this a bug or feature?

It's a feature, usually used like this:

const char ident[] = "$Id$";

Many unix machines have a program called 'ident' that will print the version strings that went into a linked executable.

Is there a way to avoid this?

Not short of turning off keyword expansion. Perforce doesn't know c++ syntax (or that of any other language, AFAIK).

I have been troubled by it a few times. ISTR I once had a function that searched for "$Id$" and of course that function's search string got changed. But it's never been very difficult to work around the problem.

If you're using plain C++, maybe you can use the preprocessor's string concatenation: "$Da" "te$" is the same as "$Date$".

--Arnt