[SciPy-Dev] bool wrapper in sparse
Wed Jun 26 16:22:52 CDT 2013
So basically I define a class that behaves like bool, but add compiler
specific parameters to make instance of this class 1 byte?
On Wed, Jun 26, 2013 at 12:17 PM, Pauli Virtanen <email@example.com> wrote:
> 26.06.2013 19:34, Nathaniel Smith kirjoitti:
> > In c++, user classes can't inherit from primitive types. Thus spake
> > Make a memory-layout compatible class (i.e., one with a single npy_bool
> > member), and then cast back and forth as needed?
> I somehow doubt that
> class Foo
> char b;
> assert(sizeof(b) == sizeof(char));
> is guaranteed by C++ standards. However, we can just start inserting
> compiler-specific packing pragmas for those cases where it isn't true.
> For safety, however, it's probably best to include the assert statement
> in one of the routines. The compiler should optimize it away, and it
> will break scipy test suite if the file is miscompiled.
> Pauli Virtanen
> SciPy-Dev mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the SciPy-Dev