• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Is there a bug in #include operation?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is there a bug in #include operation?


  • Subject: Re: Is there a bug in #include operation?
  • From: Denis Stanton <email@hidden>
  • Date: Tue, 2 Mar 2004 11:02:45 +1300

Hi Allan

Thank you for clarifying this.

Including aaa.h from ccc.h will just be ignored by the compiler (at least if you use import instead of include) -- as it would otherwise go into an infinite loop.

My error was in misunderstanding what "will be ignored by the compiler" means. I though the compiler would ignore the duplicated request to import because it already had the file, but then it would be kind enough to use the file it already had. What you have said confirms my fear. It ignores the reference that would create a loop, but then complains that the reference was not satisfied. I thought that such loops were inevitable and therefore the compiler would have a strategy for them. As has been pointed out elsewhere, placing (most of) the imports into the .m files, rather than having all my .h files importing each other avoids the loop situation

Denis

On Tuesday, March 2, 2004, at 10:27 AM, Allan Odgaard wrote:

On 1. Mar 2004, at 21:33, Denis Stanton wrote:

Is there a problem in Xcode 1.1's handling of #include where classes are mutually dependent ?

I Doubt it...

I have written about 20 classes. There are many dependencies so each .h file contains one or more #include statements. In some cases these could form loops. so aaa.h includes bbb.h, bbb.h includes ccc.h and ccc.h includes aaa.h

You cannot have loops. If the include order is as you say, the compiler will generate a source similar to:

cat >tmp.h ccc.h bbb.h aaa.h

If you look at tmp.h, you'll see that that the top of this file is ccc.h, so if ccc.h require parts of aaa.h, then it will not work, because these are defined in the bottom of tmp.h

Including aaa.h from ccc.h will just be ignored by the compiler (at least if you use import instead of include) -- as it would otherwise go into an infinite loop.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


Denis Stanton
email@hidden
Home: +64 9 533 0391
mobile: +64 21 1433622
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: Is there a bug in #include operation?
      • From: Kyle Moffett <email@hidden>
References: 
 >Re: Is there a bug in #include operation? (From: Allan Odgaard <email@hidden>)

  • Prev by Date: Re: Databasing and Cocoa
  • Next by Date: Can't complete drop operation...
  • Previous by thread: Re: Is there a bug in #include operation?
  • Next by thread: Re: Is there a bug in #include operation?
  • Index(es):
    • Date
    • Thread