• 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: unions named the same cause compiler error
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: unions named the same cause compiler error


  • Subject: Re: unions named the same cause compiler error
  • From: Clark Cox <email@hidden>
  • Date: Wed, 23 Dec 2009 11:25:21 -0500

On Tue, Dec 22, 2009 at 1:17 PM, August Hahn <email@hidden> wrote:
> I have code like this:
>
> @interface ClassA : NSObject
> {
>        union _some_union {
>                int x;
>                float y;
>        } u;
> }
> @end
>
> @interface ClassB : NSObject
> {
>        union _some_union {
>                int x;
>                float y;
>        } u;
> }
> @end
>
> when I compile, I get an error saying the second _some_union is a redefinition. Shouldn't the two be distinct, since they're in different classes?

No. In C (and Objective-C), all unions share the same namespace (as do
all structs and enums)

--
Clark S. Cox III
email@hidden
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >unions named the same cause compiler error (From: August Hahn <email@hidden>)

  • Prev by Date: Re: help fixing overflow warning with abs()...
  • Next by Date: Re: Running a Build Phase as Root
  • Previous by thread: Re: unions named the same cause compiler error
  • Next by thread: Warning in error
  • Index(es):
    • Date
    • Thread