From e5ea77f802d32d272a81a1d11e479e3ec3969b3f Mon Sep 17 00:00:00 2001 From: Leif Andersen Date: Tue, 30 Oct 2018 15:39:10 -0400 Subject: [PATCH] Note that _enum in Racket and enum in C use different backings. (#2308) * Note that _enum in Racket and enum in C use different backings. (It is worth noting that C does not specify the backing for enum, but does say its range is that of an int.) --- pkgs/racket-doc/scribblings/foreign/types.scrbl | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/pkgs/racket-doc/scribblings/foreign/types.scrbl b/pkgs/racket-doc/scribblings/foreign/types.scrbl index 52aaabf153..6117d50f59 100644 --- a/pkgs/racket-doc/scribblings/foreign/types.scrbl +++ b/pkgs/racket-doc/scribblings/foreign/types.scrbl @@ -1736,7 +1736,19 @@ is to throw an exception. (_enum '(ok = 0 invalid_input buffer_too_small))) -]} +] + +Note that the default basetype is @racket[_ufixint]. This +differs from C enumerations that can use any value in +@racket[_fixint]. Any @racket[_enum] using negative values +should use @racket[_fixint] for the base type. + +@examples[#:eval ffi-eval + (define @#,racketidfont{_negative_enum} + (_enum '(unkown = -1 + error = 0 + ok = 1) + _fixint))]} @defproc[(_bitmask [symbols (or symbol? list?)] [basetype ctype? _uint]) ctype?]{