We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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?
In the olden days with slow computers and paper tapes (or whatever) this was a huge issue.
Today, who cares if a build takes 3 or 5 seconds.
I have no idea what the effect is when using uVision, but with commandline build a total build of a 20 file project is about 5 seconds.
Erik
The IDE should not matter in this case. Todays compilations are almost fully controlled by the amount of optimization. For some tools, the link step can also take a lot of time if a project is big and has debug information - especially C++ can produce huge amounts of debug information.
Remember that you don't build with high optimization levels :)
"Today, who cares if a build takes 3 or 5 seconds."
We used to have some bloke here with a poster that stated something along the lines of:
"Remember guys, the faster your computer, the bigger your ....."
(I'll let you fill in the missing word.)
True - I don't think build time is the big issue here.
I think the issues of modularity, etc, are for more important...
Hi Andy and Per,
Many thanks to your help.
There are still a lot of things that I need to learn, hope one day I can become a better programmer.
I didn't know the difference between enum and #define. So I did some study. Though it might be some kind of common sense for most people here, I think it is not bad to put an URL about "Enum Vs #define" here.
http://www.keil.com/forum/docs/thread7149.asp
Sorry for any confusion, but I normally always use enum unless the intended target is the preprocessor (conditional compilation), or I declare a non-integer constant. enum can't be used for strings or floating point...
Ah, Sausage, a blok I used to work with hung this slogan on his monitor:
"wie stabiliteit wilt, kan geen schoonheid verwachten"
which means:
"The one that wants stability, cannot expect beauty"
It was funny that it was printed with these ornaments positioned around the inscription, like it was some kind of a religious decree [is it? I bet "Jack Sprat" knows :-) :-) ]
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!
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
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.
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.