On Apr 30, 2015, at 4:57 PM, Quincey Morris <[email protected]> wrote:
> On Apr 30, 2015, at 13:29 , William Squires <[email protected]> wrote: >> >> If I understand properly, you can't have a circular #import > > You can in the sense that if A.h #imports B.h, and B.h #imports A.h, then B.h > can only see the contents of A.h up till the point that it #imports B.h. It’s > circular (and therefore doesn’t produce the desired effect), though it’s not > recursive like #include can be. > Oh, okay. I figured it would do something like: * Import A.h and determine that it hasn't been read yet; read it into memory. Mark it as 'in-use' * Compiler/pre-processor sees a #import "B.h" in A.h, and goes back to step 1, this time reading in B.h. * It then sees that B.h hasn't been read yet, and reads it into memory. It is then marked as 'in-use' * The compiler then sees that B.h #imports "A.h", but realizes that A.h is already in use, and skips it. * It continues processing B.h until EOF, then releases the in-use flag, and closes B.h * At this point, it has all the symbol table info from B.h, and returns to processing A.h from the line just after the #import "B.h" * It then has all the symbol table info from A.h as well, then releases its in-use flag, and closes the file. Now, both the symbols from A.h and B.h have been read (only once), and no infinite loop causes the SPOD. :) Guess not... [snip] _______________________________________________ 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]
