[p4] Perforce keyword expansion

Peter Jaeckel Peter.Jaeckel at impress.com
Tue Dec 4 06:48:30 PST 2001


Hi,

Perhaps another solution in this special case would be to switch
the type from k+text to ko+text this will only substitute $Id$ and 
$Header$.

	Cheers,
	Peter Jaeckel

-----Original Message-----
From: Arnt Gulbrandsen [mailto:arnt at gulbrandsen.priv.no]
Sent: Dienstag, 4. Dezember 2001 14:03
To: Schlueter, Michael
Cc: 'perforce-user at perforce.com'
Subject: Re: [p4] Perforce keyword expansion


"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
_______________________________________________
perforce-user mailing list  -  perforce-user at perforce.com
http://maillist.perforce.com/mailman/listinfo/perforce-user



More information about the perforce-user mailing list