Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. working with C++ includes and examining header files used in LLVM

working with C++ includes and examining header files used in LLVM

Scheduled Pinned Locked Moved C / C++ / MFC
c++
5 Posts 4 Posters 4 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    ngochuyen binhhoa
    wrote on last edited by
    #1

    Recently, I have been working with C++ includes and while examining those used in LLVM, I came across several H header files that caught my attention. I noticed that they were not templated and contained both declarations and definitions with code. To my surprise, I found that these header files were included in multiple CPP source files. Although they only define classes, I am concerned that this may result in code bloat since each source file must generate the binary for each class implementation. In my own work, I prefer to place the implementation of any non-templated class in its own CPP source file and let the linker handle it. I consider this to be essential. However, since the writers of LLVM are undoubtedly more knowledgeable, experienced, clever, and intelligent than I am, I wonder if there is something that I do not understand. Thank you.

    CPalliniC L 2 Replies Last reply
    0
    • N ngochuyen binhhoa

      Recently, I have been working with C++ includes and while examining those used in LLVM, I came across several H header files that caught my attention. I noticed that they were not templated and contained both declarations and definitions with code. To my surprise, I found that these header files were included in multiple CPP source files. Although they only define classes, I am concerned that this may result in code bloat since each source file must generate the binary for each class implementation. In my own work, I prefer to place the implementation of any non-templated class in its own CPP source file and let the linker handle it. I consider this to be essential. However, since the writers of LLVM are undoubtedly more knowledgeable, experienced, clever, and intelligent than I am, I wonder if there is something that I do not understand. Thank you.

      CPalliniC Offline
      CPalliniC Offline
      CPallini
      wrote on last edited by
      #2

      Quote:

      I came across several H header files that caught my attention. I noticed that they were not templated and contained both declarations and definitions with code.

      Do you mean member functions implemented inside the class definitions (they are inlined, so multiple inclusion is allowed)?

      "In testa che avete, Signor di Ceprano?" -- Rigoletto

      In testa che avete, signor di Ceprano?

      1 Reply Last reply
      0
      • N ngochuyen binhhoa

        Recently, I have been working with C++ includes and while examining those used in LLVM, I came across several H header files that caught my attention. I noticed that they were not templated and contained both declarations and definitions with code. To my surprise, I found that these header files were included in multiple CPP source files. Although they only define classes, I am concerned that this may result in code bloat since each source file must generate the binary for each class implementation. In my own work, I prefer to place the implementation of any non-templated class in its own CPP source file and let the linker handle it. I consider this to be essential. However, since the writers of LLVM are undoubtedly more knowledgeable, experienced, clever, and intelligent than I am, I wonder if there is something that I do not understand. Thank you.

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        There is plenty of information on the thinking behind this project at The LLVM Compiler Infrastructure Project[^].

        J 1 Reply Last reply
        0
        • L Lost User

          There is plenty of information on the thinking behind this project at The LLVM Compiler Infrastructure Project[^].

          J Offline
          J Offline
          jschell
          wrote on last edited by
          #4

          Richard MacCutchan wrote:

          There is plenty of information...

          Am I misreading that? Seems like the project is focused on compilation? Thus why would the OP ask the question in the first place? An enterprise system will be vastly bigger than the compiler. That is going to be true for all but the very smallest of product companies. Service companies would probably always be bigger than that. Even a system which is doing dynamic compilation as part of the business logic should still restrict that part to a very small subset of of the system, and probably a company library. So am I just not understanding what LLVM is?

          L 1 Reply Last reply
          0
          • J jschell

            Richard MacCutchan wrote:

            There is plenty of information...

            Am I misreading that? Seems like the project is focused on compilation? Thus why would the OP ask the question in the first place? An enterprise system will be vastly bigger than the compiler. That is going to be true for all but the very smallest of product companies. Service companies would probably always be bigger than that. Even a system which is doing dynamic compilation as part of the business logic should still restrict that part to a very small subset of of the system, and probably a company library. So am I just not understanding what LLVM is?

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            jschell wrote:

            why would the OP ask the question in the first place?

            The question makes specific reference to LLVM, so I assume that is what he is concerned about. I stand ready to be corrected.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups