Roy said:
Hi ,
could you please list the reasons why we different C files for writing
code .
We use header files to logically group functionality that is related .
Is there any other reason why we need to use
different C files ?
limitations and editability in text editors...
saving needing to build the whole project at one.
....
most of the time, I like keeping source files to between 500 and 1000 lines.
too much smaller, and one is going berserk with the text editor (and the
annoyingly small amount of windows resources, ESP in vista, where it is
amazingly small and maybe about 20-something notepads and a few IE windows
and stuff starts breaking... FFS at least in XP I could get up to around
50-70 notepads...).
this is one thing that nearly drives me insane about Java (among other
things). uber-chibi isn't always kawaii...
now, too much than about 1000 (or maybe 2000), and typically one encounters
a kind of scrolling nightmare...
one can end up having to scroll damn near forever to find the exact function
they are looking for ("well, I know it was around here somewhere...").
except, in some rare cases...
in my compiler, my cast-conversion function (gradually ended up along in its
own file), is something like several kloc, for a single function (considered
before splitting it up, oh well...).
so, it is a tradeoff really...
by the time projects reach well into the double-digit kloc range, the need
for multiple files is obvious.
well into the tripple-digit kloc range, and a single massive source file
would seem almost insane...
"watch as I scroll around, at uber speeds, through this 450,000 line beast,
in search of a single 50-line function for which I have forgotten the
name...".
of course, anyone who doubts me is more than free to try...