Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualAardvajk

Posted 23 December 2012 - 03:13 PM

I take the view that if I only need to use pointers or references in the including header, I use a forward reference. As soon as I find myself naturally needing anything more than a pointer or reference, I include the file unless I have a very good reason not to (circular dependancy etc).

Sometimes if the first case is true except for also needing an enumeration type or something else defined in the header, I'll consider splitting the header out.

Compile time is a serious consideration for me at work as a full rebuild of our source takes about 20 minutes for me, which is a long time to be paid to twiddle my thumbs and check email. However, even bearing this in mind, I'd not compromise code design or runtime efficiency in order to improve compile time with the abuse of forward declarations.

#2Aardvajk

Posted 23 December 2012 - 03:12 PM

I take the view that if I only need to use pointers or references in the including header, I use a forward reference. As soon as I find myself naturally needing anything more than a pointer or reference, I include the file unless I have a very good reason not to (circular dependancy etc).

Sometimes if the first case is true except for also needing an enumeration type or something else defined in the header, I'll consider splitting the header out.

Compile time is a serious consideration for me at work as a full rebuild of our source takes about 20 minutes for me, which is a long time to be paid to twiddle my thumbs and check email. However, even bearing this in mind, I'd not compromise code design or runtime efficiency in order to improve compile time with the abuse of forward declarations.

#1Aardvajk

Posted 23 December 2012 - 03:12 PM

I take the view that if I only need to use pointers or references in the including header, I use a forward reference. As soon as I find myself naturally needing anything more than a pointer or reference, I include the file unless I have a very good reason not to (circular dependancy etc).<br /><br />Sometimes if the first case is true except for also needing an enumeration type or something else defined in the header, I'll consider splitting the header out.<br /><br />Compile time is a serious consideration for me at work as a full rebuild of our source takes about 20 minutes for me, which is a long time to be paid to twiddle my thumbs and check email. However, even bearing this in mind, I'd not compromise code design or runtime efficiency in order to improve compile time with the abuse of forward declarations.

PARTNERS