From: Greg Colvin (gcolvin_at_[hidden])
Date: 2001-02-09 14:32:30
From: Phlip <pplumlee_at_[hidden]>
> 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:
> 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
> ...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.)
I strongly suspect that the type of __null is indeed relevant.
> Here's the function to make the goods. I made the names up to protect the
> static organ_ptr_t
> makeOrgan(char const * name)
> if (name)
> organ_ptr_t result (new organ);
> result -> m_strName = name;
> return result;
> 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
> 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