lint

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Roman Mashak

    #1

    lint

    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: mrv@tusur.ru


  • Artie Gold

    #2
    Re: lint

    Roman Mashak wrote:[color=blue]
    > 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.[/color]

    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

    Comment

    • Roman Mashak

      #3
      Re: lint

      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: mrv@tusur.ru


      Comment

      • Jonathan Bartlett

        #4
        Re: lint

        [color=blue]
        > How is it supposed to use these arrays: informational meaning or some else?[/color]

        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.
        [color=blue]
        > How is it essential to have it in program?[/color]

        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

        Comment

        • Chris Croughton

          #5
          Re: lint

          On Wed, 29 Jun 2005 10:10:57 -0400, Jonathan Bartlett
          <johnnyb@eskimo .com> wrote:
          [color=blue][color=green]
          >> How is it supposed to use these arrays: informational meaning or some else?[/color]
          >
          > 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.[/color]

          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.
          [color=blue][color=green]
          >> How is it essential to have it in program?[/color]
          >
          > It's not essential (at least from a compile/execution perspective -- it
          > may be essential in terms of company policy wherever that was written).[/color]

          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

          Comment

          Working...