Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

>For C, I'd say the biggest benefit is that you can absorb a clearer picture of how parts of your project are using other parts, because your .c files have to directly include the headers they use.

It may just be that this is the specific way in which my mind works, but I find it easier to get a clearer picture of the file if I just read the .h. It would have a summary (in terms of comments and code, like function declarations) and a list of includes.

>it is often very useful if you can immediately see a short list of .c files that could possibly access the interface exposed by a particular header file.

If you wanted to see which files use the interface in that header file directly, you can scan your headers for ones that include it explicitly, instead of working backward from the header. And a similar thing with the autocomplete problem: only load the header files mentioned in thing.h (assuming you're editing thing.c).

The increased compilation time is a good argument. I don't know any good way to mitigate it, but all these three problems sound like engineering problems to me, rather than a problem intrinsic to this approach.



> If you wanted to see which files use the interface in that header file directly, you can scan your headers for ones that include it explicitly, instead of working backward from the header.

Your .c files that use the interface will often be including it implicitly though, projects very quickly drift in that direction.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: