Re: [sigc] Renaming nil
- From: MHL Schulze t-online de (Martin Schulze)
- To: Régis Duchesne <hpreg vmware com>
- Cc: libsigc-list gnome org
- Subject: Re: [sigc] Renaming nil
- Date: Wed, 24 May 2006 23:49:14 +0200
Régis Duchesne schrieb:
Folks,
I need to include libsigc++ (C++) header files from an Objective-C++
file (yes, there is such a monstrosity). It fails to compile.
The problem is that:
o libsigc++ defines sigc::nil
o 'nil' is a reserved keyword of Objective-C (just like 'return' is a
reserved keyword of C)
o Objective-C++ is a superset of Objective-C
For a few months, the workaround I used was to put this at the top of
my Objective-C++ files, _before_ including any sigc header, of course:
#define nil empty
Now is the time for me to do things right, and submit a fix upstream
to libsigc++.
There are a few questions though:
1) Which name should we use instead of 'nil'? Murray recommends
'none'. I don't really care. I think the name is mostly seen during
compile failures and debugging sessions. So we want something short,
and we want something that is unlikely to conflict with C++-compatible
languages.
2) Should we do the rename unconditionally or only if the headers are
being read by an Objective-C++ compiler? I think it is fine to do it
conditionally, to avoid introducing any source incompatibility
(although I don't think people actually use 'nil' in their source code
in practice, it is theoretically possible they are).
3) Will this introduce any binary incompatibility? Murray and I think
it won't, because sigc::nil is only declared as a type, but it is
never instantiated. As such, we don't think the libsigc++ library
binary actually cares about it. And so far, my experiment seems to
confirm that (linking and running my Objective-C++ code against the
libsigc++ library binary seems to work fine). Is there a way to know
for sure?
Your advise is welcome,
1) I think for the 2.0 branch the rename should be done conditionally.
2) 'none' is fine and probably closer to the actual meaning of the
definition than 'empty'.
3) I don't know any reason why it should not be binary compatible.
Regards,
Martin
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]