lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]



On Mar 22, 2014, at 5:26 PM, William Ahern <william@25thandClement.com> wrote:

I think the issue with C's heritage is overblown, especially considering
that modern compilers support pre-compiled headers. The data structure
definitions that must be parsed from header files would also have to be
parsed and loaded from binary formats, and the speed benefits aren't really
that astounding. I think the greater problem is the practice of people
having dozens or even hundreds of compilation units. In many projects every
little C or C++ file has like 2 or 3 functions defined. Far fewer people do
stupid stuff like that in Java, C#, or other languages.

+1 to that … i’ve never been a fan of the “lots of small files” style of coding that emerged sometime in the 1990’s for C. I’ve always put it down to poor source control tools making collaboration harder when they have no decent merge tool (work-around: exclusive edits on files, hence the drift toward many+smaller source files). These days fewer+larger always seems to me more sensible as (a) you have better chances for the compiler to do global optimizations, (b) compilation is faster as headers are loaded fewer times, (c) files can be used as “module” boundaries with implementation functions declared as static, (d) far fewer “bridging” header files to carry declarations between all those smaller source files.

Just my 20c here :)

—Tim