Skip to content

Document somewhere that enums can be either c_int or c_uint #1966

@saschanaz

Description

@saschanaz

Input C/C++ Header

enum TestEnum {
  FOO,
  BAR
};

Bindgen Invocation

$ bindgen input.h

Actual Results

On Windows:

/* automatically generated by rust-bindgen 0.56.0 */

pub const TestEnum_FOO: TestEnum = 0;
pub const TestEnum_BAR: TestEnum = 1;
pub type TestEnum = ::std::os::raw::c_int;

On Ubuntu:

/* automatically generated by rust-bindgen 0.56.0 */

pub const TestEnum_FOO: TestEnum = 0;
pub const TestEnum_BAR: TestEnum = 1;
pub type TestEnum = ::std::os::raw::c_uint;

Expected Results

This should be documented somewhere. All I found is this comment: #1096 (comment)

Bindgen uses whatever enum type comes from clang, so if it's a u32, clang is picking a u32 type for it.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions