Check unnecessary Header file inclusion

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Parag Mahajan

    Check unnecessary Header file inclusion

    Hi,

    I would like to know if there is any way / tool available by which we
    can detect unnecessary header files included in the source files.

    Regards,
    Parag.
  • Ian Collins

    #2
    Re: Check unnecessary Header file inclusion

    Parag Mahajan wrote:
    Hi,
    >
    I would like to know if there is any way / tool available by which we
    can detect unnecessary header files included in the source files.
    >
    Why bother?

    --
    Ian Collins.

    Comment

    • Greg Herlihy

      #3
      Re: Check unnecessary Header file inclusion

      On Mar 29, 12:01 am, Ian Collins <ian-n...@hotmail.co mwrote:
      Parag Mahajan wrote:
      >
      I would like to know if there is any way / tool available by which we
      can detect unnecessary header files included in the source files.
      >
      Why bother?
      To reduce build times.

      Greg

      Comment

      • Ian Collins

        #4
        Re: Check unnecessary Header file inclusion

        Greg Herlihy wrote:
        On Mar 29, 12:01 am, Ian Collins <ian-n...@hotmail.co mwrote:
        >Parag Mahajan wrote:
        >>
        >>I would like to know if there is any way / tool available by which we
        >>can detect unnecessary header files included in the source files.
        >Why bother?
        >
        To reduce build times.
        >
        Hardly, unless your build system is grossly underspecified.

        --
        Ian Collins.

        Comment

        • Parag Mahajan

          #5
          Re: Check unnecessary Header file inclusion

          On Mar 29, 2:34 am, Ian Collins <ian-n...@hotmail.co mwrote:
          Greg Herlihy wrote:
          On Mar 29, 12:01 am, Ian Collins <ian-n...@hotmail.co mwrote:
          Parag Mahajan wrote:
          >
          >I would like to know if there is any way / tool available by which we
          >can detect unnecessary header files included in the source files.
          Why bother?
          >
          To reduce build times.
          >
          Hardly, unless your build system is grossly underspecified.
          >
          --
          Ian Collins.
          One reason is to reduce the build time and another one is to actually
          make sure we do have only required header inclusions in our source
          files.

          Regards,
          Parag.

          Comment

          • Jack Klein

            #6
            Re: Check unnecessary Header file inclusion

            On Fri, 28 Mar 2008 23:46:41 -0700 (PDT), Parag Mahajan
            <paragvm@gmail. comwrote in comp.lang.c++:
            Hi,
            >
            I would like to know if there is any way / tool available by which we
            can detect unnecessary header files included in the source files.
            >
            Regards,
            Parag.
            PC Lint from Gimpel (www.gimpel.com) can do this. It is a commercial
            product, not free or open source. I have never actually used it for
            this purpose on C++, but I know it works quite well in C.

            --
            Jack Klein
            Home: http://JK-Technology.Com
            FAQs for
            comp.lang.c http://c-faq.com/
            comp.lang.c++ http://www.parashift.com/c++-faq-lite/
            alt.comp.lang.l earn.c-c++

            Comment

            • Zara

              #7
              Re: Check unnecessary Header file inclusion

              On Sat, 29 Mar 2008 12:38:05 -0500, Jack Klein <jackklein@spam cop.net>
              wrote:
              >On Fri, 28 Mar 2008 23:46:41 -0700 (PDT), Parag Mahajan
              ><paragvm@gmail .comwrote in comp.lang.c++:
              >
              >Hi,
              >>
              >I would like to know if there is any way / tool available by which we
              >can detect unnecessary header files included in the source files.
              >>
              >Regards,
              >Parag.
              >
              >PC Lint from Gimpel (www.gimpel.com) can do this. It is a commercial
              >product, not free or open source. I have never actually used it for
              >this purpose on C++, but I know it works quite well in C.
              It does also work on C++,, quite nicely.

              Best regards,

              Zara

              Comment

              • Yannick Tremblay

                #8
                Re: Check unnecessary Header file inclusion

                In article <6567pjF2d1dakU 38@mid.individu al.net>,
                Ian Collins <ian-news@hotmail.co mwrote:
                >Parag Mahajan wrote:
                >Hi,
                >>
                >I would like to know if there is any way / tool available by which we
                >can detect unnecessary header files included in the source files.
                >>
                >Why bother?
                >

                Do you have the same opinion on:

                - unused variables
                - commented out unused code
                - not commented out but unreachable code
                - duplicated code
                - unchecked error return code
                - input validation
                etc

                Yan


                Comment

                Working...