GingerRobot Posted May 4, 2009 Share Posted May 4, 2009 So for some reason we we're never introduced to the concept of using multiple files and using make in our c programming module. I've no idea why. I'm sure i can work out the details with the header files and how to produce a makefile, but i was wondering about best practices regarding commenting. I usually like to place a comment along with most functions to describe it's purpose and give a parameter list and return value. However, i'm wondering whether or not most people would expect to find this information in the header files or the source files? Seems kind-of logical to place it along with the function prototype in the header file, but then i also figure that it has it's merits being put alongside the actual code of the function -- i guess people are far more likely to be reading source files than header files. Any thoughts? Quote Link to comment https://forums.phpfreaks.com/topic/156816-multifile-c-programs-and-placing-of-comments/ Share on other sites More sharing options...
corbin Posted May 4, 2009 Share Posted May 4, 2009 I would probably put it in the headers simply because if you compile a static or dynamic library and then people link programs against that later, they might not ever see the source code. For example, I use Winsock2 every now and then. I don't have the source to it, but I can look at the header. Edit: I have no idea what the correct way is though since I've never coded anything in C that's not for exclusively my own use. Quote Link to comment https://forums.phpfreaks.com/topic/156816-multifile-c-programs-and-placing-of-comments/#findComment-826176 Share on other sites More sharing options...
GingerRobot Posted May 6, 2009 Author Share Posted May 6, 2009 Alright, i think im probably going to stick with the commenting in the header files. Hopefully my lecturer'll able to find them Quote Link to comment https://forums.phpfreaks.com/topic/156816-multifile-c-programs-and-placing-of-comments/#findComment-827319 Share on other sites More sharing options...
corbin Posted May 7, 2009 Share Posted May 7, 2009 If he can't, it's so not my fault. Quote Link to comment https://forums.phpfreaks.com/topic/156816-multifile-c-programs-and-placing-of-comments/#findComment-828225 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.