[racket-dev] ffi sizeof bool

2014-04-04 Thread Tobias Hammer
Hi, i guess this shouldn't happen: $ cat s.cc #include stdio.h int main() { printf(%zu\n, sizeof(bool)); } $ g++ s.cc -o s $ ./s 1 Welcome to Racket v6.0.0.5. - (require ffi/unsafe) - (ctype-sizeof _bool) 4 Tested with multiple unix/linux OS, all gcc 4.3.4 Tobias

Re: [racket-dev] ffi sizeof bool

2014-04-04 Thread Matthew Flatt
Yes, `_bool` is a problem. I'll add a `_stdbool` that corresponds to `bool` from C99's stdbool.h, which I imagine must be the same as `bool` in C++. At Fri, 4 Apr 2014 08:56:18 +0200, Tobias Hammer wrote: Hi, i guess this shouldn't happen: $ cat s.cc #include stdio.h int main() {

Re: [racket-dev] ffi sizeof bool

2014-04-04 Thread Tobias Hammer
Just checked and _Bool is also 1 byte, same as C++. What i don't understand yet is to which standard does the current _bool conform? I couldn't find any platform with int sized bool. On Fri, 04 Apr 2014 17:10:30 +0200, Matthew Flatt mfl...@cs.utah.edu wrote: Yes, `_bool` is a problem.

Re: [racket-dev] ffi sizeof bool

2014-04-04 Thread Matthew Flatt
The current `_bool` is pre-standard. It specifically reflects (I think) the absence of a bool type in libffi, which in turn is an artifact (I assume) of `bool` not existing in a C standard before C99. Lots of libraries have a bool variant that is `int`-sized, so I imagine that's where the