|
Boost : |
From: Phlip (pplumlee_at_[hidden])
Date: 2001-02-09 14:19:19
Proclaimed Greg Colvin from the mountaintops:
> What is NULL defined as on your system? ((void*)0) ?
I see it's time for a version dump:
LinuxPPC
g++ 2.95.2
This line returns an error:
char * a = (void*)0;
And these lines...
#define DEBUG_(x) cout << WRAP(x) << endl
#define WRAP(x) #x
DEBUG_(NULL)
...return "__null".
This is an amusing chain of events, and I could look up g++'s '__null' for
you, but I don't see how it's relevant. (Then again I had no idea one
could do what Boost does with traits.)
Here's the function to make the goods. I made the names up to protect the
guilty:
static organ_ptr_t
makeOrgan(char const * name)
{
if (name)
{
organ_ptr_t result (new organ);
result -> m_strName = name;
return result;
}
else
return organ_ptr_t (NULL);
}
The result eventually passes to Python, and that (after the line aOrgan ==
None) enlightens us with this:
if aOrgan.getName() == "": return
RuntimeError: Converting from python, pointer or smart pointer to <5organ>
is NULL.
What's happening is this line fails to detect the NULL as a None:
if aOrgan == None: return
Then the next line bombs.
Right now I'm using a sentinel value instead of this NULL to mark a
non-existent item, but I'd rather be able to use Python's built in None
correctly.
-- Phlip phlip_cpp_at_[hidden] ============ http://c2.com/cgi/wiki?PhlIp ============ -- http://www.osdi.org/phpwiki/index.php?LinuxChix --
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk