lint

Discussion in 'C Programming' started by Roman Mashak, Jun 29, 2005.

  1. Roman Mashak

    Roman Mashak Guest

    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:
     
    Roman Mashak, Jun 29, 2005
    #1
    1. Advertising

  2. Roman Mashak

    Artie Gold Guest

    Roman Mashak wrote:
    > 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


    --
    Artie Gold -- Austin, Texas
    http://it-matters.blogspot.com (new post 12/5)
    http://www.cafepress.com/goldsays
     
    Artie Gold, Jun 29, 2005
    #2
    1. Advertising

  3. Roman Mashak

    Roman Mashak Guest

    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:
     
    Roman Mashak, Jun 29, 2005
    #3

  4. > 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
    ----
    Learn to program using Linux assembly language
    http://www.cafeshops.com/bartlettpublish.8640017
     
    Jonathan Bartlett, Jun 29, 2005
    #4
  5. On Wed, 29 Jun 2005 10:10:57 -0400, Jonathan Bartlett
    <> wrote:

    >> 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.


    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.

    >> 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).


    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
     
    Chris Croughton, Jun 29, 2005
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Vincent Cate
    Replies:
    14
    Views:
    1,695
    Chris Smith
    Dec 22, 2003
  2. Replies:
    0
    Views:
    416
  3. Captain Dondo

    css 'lint'

    Captain Dondo, Jun 24, 2005, in forum: HTML
    Replies:
    1
    Views:
    1,083
    Spartanicus
    Jun 24, 2005
  4. Greg Roberts
    Replies:
    33
    Views:
    6,696
    Mark McIntyre
    Feb 5, 2004
  5. David Sudolcan
    Replies:
    7
    Views:
    2,136
    Eric Sosman
    Apr 4, 2011
Loading...

Share This Page