Re: Nil and nil Macro Conflict
Re: Nil and nil Macro Conflict
- Subject: Re: Nil and nil Macro Conflict
- From: Andreas Grosam <email@hidden>
- Date: Wed, 02 May 2012 09:38:46 +0200
On May 2, 2012, at 7:46 AM, Don Quixote de la Mancha wrote:
> Are not both Objective-C and C++, as well as Objective-C++
> case-sensitive? If so, Nil and nil should be different symbols.
They are case-sensitive. Both, "nil" and "Nil" are different macros defined for different purposes in Objective-C:
"nil" is the NULL-pointer for an Object,
"Nil" is the NULL-pointer for a Class (object).
Both effectively map to __DARWIN_NULL on Mac OS X.
> If they should be, and really are different symbols, but still conflict
> somehow, then you've actually got a different problem than you think
> you do.
To clarify, I don't have a conflict with "Nil" against "nil" - but a conflict with a C++ class name
nm::nil with nil, and a class name nm::Nil and Nil.
where "nm" stands for an arbitrary qualifier list (namespaces).
>
> Do Not Let The Sun Go Down Until You've Read John Lakos' excellent
> book "Large Scale C++ Software Design", published by Addison-Wesley.
> Much of what he proposes will contribute to the solution of your
> conflicting symbol problem.
I can believe this is an excellent read and it would certainly add values to my knowledge. Though my current problem shouldn't be such an issue and it feels it's digressing. It's just that an Objective-C++ module includes a C++ header with symbols "Nil" and "nil" - and there is no other non-Objective-C module at all where I could move it to.
> …
Your recommendations and suggestions in the above make certainly sense, and I - as far as I can ensure you - try to follow these proposed guidelines, probably even drifting to the other extreme which results in more independent files than absolutely necessary. Though, in my current project, all code is templates and "header only" - encapsulation of "private symbols" is accomplished through namespaces. (You may even take a look at the sources - they are open source ;) )
Regards
Andreas
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden