[p4] RE: Perforce keyword expansion

Simon Morton Simon.Morton at MetraTech.com
Wed Dec 5 08:05:42 PST 2001

> I just found out that the perforce keyword expansion even 
> replaces the keywords normal c++ constant strings.
> Is this a bug or feature?

It is absolutely a feature.  Embedding keywords in string constants
means you can access them programmatically and print/display them from
within the application, say in a title bar or in response to a -v 
option.  It also means that they persist in the binary forms of the
application so that you can use strings or ident to extract them and
find out which version(s) you are really dealing with.

static const char rcsid[] = "$Id$"; is the oldest trick in the book.

On this subject, though, does anyone know why perforce only expands
$Id and $Header to give file and version?  In RCS they give much more

  From man RCS:

      A standard header containing the full  pathname  of
      the  RCSfile,  the  revision number, the date and
      time, the author, the state,  and  the  locker  (if

$Id$  Same  as $Header$, except that the RCS filename is
      without a path.


More information about the perforce-user mailing list