lint

R

Roman Mashak

Hello, All!

I often come across the following statements in different source code:

#ifndef lint
char copyright[] =
"@(#) Copyright (C) 2005 bla-bla-bla\n";
#endif

#ifndef lint
static char sccsid[] = "@(#)rshd.c 1.1.2 bla-bla";
#endif

Seems these serve for some kind of version control? Anyway, please explain
me the meaning of it.
Thanks.

With best regards, Roman Mashak. E-mail: (e-mail address removed)
 
A

Artie Gold

Roman said:
Hello, All!

I often come across the following statements in different source code:

#ifndef lint
char copyright[] =
"@(#) Copyright (C) 2005 bla-bla-bla\n";
#endif

#ifndef lint
static char sccsid[] = "@(#)rshd.c 1.1.2 bla-bla";
#endif

Seems these serve for some kind of version control? Anyway, please explain
me the meaning of it.

The arrays `copyright' and `sccsid' are there so these strings become
part of the executable (copyright should be self-explanatory, sccs is,
as you surmised, an id for source/version control).

The reason they're in the `#indef lint' blocks is that otherwise if lint
(or some lint-like tool) is being run against them, these arrays will
(most likely) generate warnings, as they are not used in the code.

HTH,
--ag
 
R

Roman Mashak

Hello, Artie!
You wrote on Tue, 28 Jun 2005 23:08:51 -0500:

AG> The arrays `copyright' and `sccsid' are there so these strings become
AG> part of the executable (copyright should be self-explanatory, sccs is,
AG> as you surmised, an id for source/version control).
How is it supposed to use these arrays: informational meaning or some else?
How is it essential to have it in program?
AG> The reason they're in the `#indef lint' blocks is that otherwise if
AG> lint (or some lint-like tool) is being run against them, these arrays
AG> will (most likely) generate warnings, as they are not used in the code.

With best regards, Roman Mashak. E-mail: (e-mail address removed)
 
J

Jonathan Bartlett

How is it supposed to use these arrays: informational meaning or some else?

The point is to just have it included in the executable. Therefore, if
someone copies it, it is _obvious_ who the copyright owner is just by
searching through the executable w/ a hex editor. Likewise for the
revision number.
How is it essential to have it in program?

It's not essential (at least from a compile/execution perspective -- it
may be essential in terms of company policy wherever that was written).

Jon
 
C

Chris Croughton

The point is to just have it included in the executable. Therefore, if
someone copies it, it is _obvious_ who the copyright owner is just by
searching through the executable w/ a hex editor. Likewise for the
revision number.

In particular there are programs like ident which will search through
for the revision information and display it, so that you can find out
which versions of which modules were used in creating that executable.
It's not essential (at least from a compile/execution perspective -- it
may be essential in terms of company policy wherever that was written).

It may also be essential (from a company policy viewpoint) to have the
code compile or lint free of warnings, hence the preprocessor directives
(having just spent a day getting rid of warnings in code so that it is
allowed to be checked in, it's a pain but has to be done if that' the
policy).

Chris C
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

tolower() and toupper() 8
re-definition of standard types 9
setting macro 6
using '__' in names 19
buffer overflow 20
question about 'static' definitions 3
missing initializer 4
padding mechanism in structures 10

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top