[Github-comments] [geany/geany] filetypesprivate.h: Don't include build.h (#2299)

LarsGit223 notifications at xxxxx
Sat Sep 14 08:56:54 UTC 2019


> This doesn't make any sense, the point of including headers is so that definitions are available to compilers for checking and optimisations. By making them opaque pointers that is defeated.

I disagree. If items inside ```struct GeanyBuildCommand``` are private and shall only be used inside ```build.c``` then it is practicable to use a forward declaration and hide the struct items. No code outside ```build.c``` can then use the struct in a wrong way. Of course this requires functions to access/use all aspects of ```struct GeanyBuildCommand```. As the ```struct GeanyFiletypePrivate``` only uses pointers to ```struct GeanyBuildCommand``` the compiler has all information it needs and can still do type checks etc. (it is still a ```struct GeanyBuildCommand *``` not a ```void *```). If something was missing then there would be a compiler error. But I would prefer a forward declaration with typedef.

As long as the items of ```struct GeanyBuildCommand``` shall only be used in ```build.c``` and if it shall stay like that in the future then I actually consider this good style.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/2299#issuecomment-531463173
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20190914/f24db678/attachment.html>


More information about the Github-comments mailing list