🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #52218

Re: SCCS strings embedded in code with -Wall

#52218
From: Paul Eggert
Date: Wed, 20 Jan 1993 03:58
21 lines
1689 bytes
parma@picker.com (Mike Parma) writes:

>In article <bkFYsLbr@twinsun.com> eggert@twinsun.com (Paul Eggert) writes:
>>	static char rcsid[] = "$Id: ... $";
>>	print_version() { printf("version: %s\n", rcsid); }

>The problem with the above solution is that now 'print_version' is
>a global function that might conflict with another '.c' file

That argument misses the main point, which is that the program must _use_
the version character string -- e.g. to print out the version number.
If the program doesn't use the string, then there's no way for it to
ensure that the compiler won't optimize the string away.
The print_version example is meant to be a function that is actually invoked,
not a function that exists solely to fool the compiler.

>I realize that 'pragma' means non-standard, but :) is there a 'common'
>one used for the above.

There are some pragmas floating around, but none of them are portable
to all (or even most) C implementations.
Technical Details
Message-ID: <bkIN#Qsp@twinsun.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!news.service.uci.edu!ucivax!ucla-cs!twinsun!eggert
References: <1993Jan15.201556.9105@picker.com> <bkFYsLbr@twinsun.com> <1993Jan18.171516.19966@picker.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,cb44527f7ddf772a
X-Google-Attributes: gid11318c,public
X-Google-ArrivalTime: 1993-01-20 05:42:34 PST
Newsgroups: gnu.gcc.help
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!news.service.uci.edu!ucivax!ucla-cs!twinsun!eggert
From: eggert@twinsun.com (Paul Eggert)
Subject: Re: SCCS strings embedded in code with -Wall
Message-ID: <bkIN#Qsp@twinsun.com>
Sender: usenet@twinsun.com
Nntp-Posting-Host: farside
Organization: Twin Sun Inc, El Segundo, CA, USA
X-Newsreader: NN version 6.4.19
References: <1993Jan15.201556.9105@picker.com> <bkFYsLbr@twinsun.com> <1993Jan18.171516.19966@picker.com>
Distribution: na
Date: Wed, 20 Jan 1993 03:58:01 GMT
Lines: 21