This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

The impact of one huge header file

Hello,
Somebody here insists that all the program's definitions will be stored in one large header file that all C modules include, rather that keeping the declarations distributed among specific header files. That sounds pretty crappy to me - but how bad it is really? will it have a very negative impact on build time?

  • I think that's not true:

    It takes skill & care to make something beautiful; I think it's far more likely that something which has been made with such skill & care will be stable than something that hasn't.

    Or maybe it was about women...

  • A while ago I thought about putting up my own little poster:

    "You're a thinker, not a doer"

    Why?

    One weekend a couple of years ago I though I'd save some money by buying a hedge trimmer and tidy the hedges around our garden myself.

    Big mistake ... I managed to get a very numb arm from swinging the trimmer up high and down low for a long period.

    So I went to the doctor, explained what I had done and he responded (without even looking at my arm):

    "It's rubbing nerves. The trouble is that you haven't realised that you're a thinker and not a doer".

    Really didn't know whether to take it as a compliment or an insult.

    Anyway ... I don't think I'll try to save money in that way again.

    Anyone want to buy a hedge trimmer? - It's only been used once!

  • Today, who cares if a build takes 3 or 5 seconds.

    this is true. but it can make a lot of difference in a debugging session, that requires some fine tunning. I think the difference in build time, in a large project, will be much more than 2 seconds...

  • I have never seen more than 5 seconds for a ~48k project

    Erik

  • Fine, but some products have dependencies other than pure C: header files might have to be parsed for other external tools for intermediate processing, and some products can consist of multiple components (i.e. binaries) that depend on one another...

  • and in either case you ca nuse one header file or multiple.

    In my opinion one or mutiple header files is a matter of shop standards (hopefully not just personal preference), either has (dis)advantages. Either will work if properly implemented.

    Erik

  • Either will work, but the big one means that any change to the header file will always force a full rebuild. If you have a couple of hundred source files, and are building with full optimization, you are likely to have to wait far longer than 5 seconds.