On Apr 30, 2015, at 10:37 PM, Quincey Morris wrote: > On Apr 30, 2015, at 18:44 , William Squires <[email protected]> wrote: >> >> * The compiler then sees that B.h #imports "A.h", but realizes that A.h is >> already in use, and skips it. > > Indeed, but the gotcha is that only the portion of A.h up till #import “B.h” > has been processed. (Because this is C, lexical analysis is linear and > textual, so it would have been illegal to proceed further in A.h until after > B.h has been processed.) Thus, although the author of B.h might have been > intending to have all of A.h available at this point, the circularity > partially violates the intention. This is presumably what happened to Alex. > > One solution is to use forward references rather than circular definitions. > > Another is to put the #import “B.h” at the end of A.h instead of earlier. > That way, when the rest of A.h gets skipped, nothing important is missed. > > The correct choice of solutions depends on what else is being defined in the > two header files. There’s no boilerplate solution.
Another solution is not to have guys who want to name every object as a bean write your iOS applications. If we're not on the main thread, then make sure to dispatch on the main thread. But I digress.
_______________________________________________ Do not post admin requests to the list. They will be ignored. Xcode-users mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/xcode-users/archive%40mail-archive.com This email sent to [email protected]
