On Thu, Oct 31, 2013 at 4:19 PM, Geoffrey Irving <irv...@naml.us> wrote: > > On Thu, Oct 31, 2013 at 2:08 AM, Robert Kern <robert.k...@gmail.com> wrote: > > On Thu, Oct 31, 2013 at 12:52 AM, Geoffrey Irving <irv...@naml.us> wrote: > >> > >> Is there a standard way in numpy of getting a char with C-native > >> integer signedness? I.e., > >> > >> boost::is_signed<char>::value ? numpy.byte : numpy.ubyte > >> > >> but without nonsensical mixing of languages? > > > > This is for interop with a C/C++ extension, right? Do this test in that > > extension's C/C++ code to expose the right dtype. As far as I know, this is > > not something determined by the hardware, but the compiler used. Since the > > compiler of numpy may be different from your extension, only your extension > > can do that test properly. > > It's not determined by the hardware, but I believe it is standardized > by each platform's ABI even if it can be adjusted by the compiler. > >From the gcc man page: > > -funsigned-char > Let the type "char" be unsigned, like "unsigned char".
Fair enough. numpy doesn't distinguish between these cases as it only uses plain 'char' for 'S' arrays, which don't really care about the numerical value assigned the bits. It explicitly uses 'signed char' elsewhere, so this platform setting isn't relevant to it. Consequently, numpy also doesn't expose this platform setting. I think I stand by my recommendation. -- Robert Kern
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion