??? 02/21/07 13:25 Read: times |
#133412 - not to write things twice Responding to: ???'s previous message |
Erik Malund said:
I see two cases 1) Shated() is huge and the latency variation will kill you, or Shared() is small so there is no reason to 'share' it. Although only the author can tell, if a huge Shared() will kill his application on latency (huge is RELATIVE isn't it); let's assume 2) is the case. The reason to "share" might be, that a routine shouldn't be written twice for maintenance reasons. If you correct copy#1 and forget to correct copy#2, you might have a problem and it might not be trivial to spot it. I know that there is a solution to it, to #include the body of function to both copy, but this is not quite a typical use of #include in C, is it, potentially causing confusion. And, at the end of the day, this won't solve the problem Chris has, if Shared() (now: Shared1() and Shared2()) calls any other function - all those function have to be identified and doubled (there is no hint from the compiler for this so error can be easily made especially when working on it later). JW |