When writing the Storable instance of a C enum that has 5 options (using c2hs), the {# sizeof #} macro returns 4 (i.e. 4 bytes). Isn't this extremely wasteful, when 3 bits would suffice? Does this depend on the size of a memory word?
Large c2hs-inferred size of C enum
73 views Asked by ocramz At
1
There are 1 answers
Related Questions in C
- How to call a C language function from x86 assembly code?
- What does: "char *argv[]" mean?
- User input sanitization program, which takes a specific amount of arguments and passes the execution to a bash script
- How to crop a BMP image in half using C
- How can I get the difference in minutes between two dates and hours?
- Why will this code compile although it defines two variables with the same name?
- Compiling eBPF program in Docker fails due to missing '__u64' type
- Why can't I use the file pointer after the first read attempt fails?
- #include Header files in C with definition too
- OpenCV2 on CLion
- What is causing the store latency in this program?
- How to refer to the filepath of test data in test sourcecode?
- 9 Digit Addresses in Hexadecimal System in MacOS
- My server TCP doesn't receive messages from the client in C
- Printing the characters obtained from the array s using printf?
Related Questions in UNIX
- Reading & Writing to the same file from terminal
- `df` command not capturing entire output in perl
- Why is it that when I pass certain directory names to `ls`, sometimes it does not list their contents?
- Detect Mouse Clicks; Terminate Program on Scroll Wheel Movement
- grep expression behaving weird (unix/mac) while reading a conf file
- Unix sub path creation and copy files
- Ignoring folders in The Silver Searcher `ag`
- struct nameidata-Linux Kernel Module
- telegraf service not able to retrieve data using the journalctl commands
- Order of options in Unix sed for editing files in-place
- Trying to echo line variable along with another variable inside a while read loop
- failed to handshake with xxx: authentication error?
- UDP socket client not able to receive data
- Invalid SCA token in unix
- How can I keep randomized UNIX timestamp in specific hour range in SQL?
Related Questions in HASKELL
- Typeclass projections as inheritance
- How to generate all possible matrices given a number n in Haskell
- Is there a way to get `cabal` to detect changes to non-Haskell source files?
- How to have fixed options using Option.Applicative in haskell?
- How can I create a thread in Haskell that will restart if it gets killed due to any reason?
- Automatic Jacobian matrix in Haskell
- Haskell writing to named pipe unexpectedly fails with `openFile: does not exist (No such device or address)`
- Why does Enum require to implement toEnum and fromEnum, if that's not enough for types larger than Int?
- Non-exhaustive patterns in function compress
- How to get terms names of GADT in Template Haskell?
- Implementing eval() function with Happy parser generator
- How to count the occurences of every element in a list in Haskell fast?
- In Haskell, what does `Con Int` mean?
- Extract a Maybe from a heterogeneous collection
- Haskell, Stack, importing module shows error "Module not found"
Related Questions in FFI
- After running a flutter project this error message appears. flutter pub get also shows an error too shown below
- Handling Memory Allocation and Pointers in Electron between Node.js and C++ DLL
- PHP FFI: How to pass PHP class object to C++
- Flutter: ffi allocator/allocate funcs
- PHP FFI - How to free memory created by FFI::new("void*[2]", false, true)
- PHP FFI - Convert void* to int
- PHP FFI - Convert PHP array to C pointers array
- Usage of precompiled library that read/write config in Flutter
- When using FFI with Deno how to deal with struct returned by a C function?
- Dart ffi NativeCallack must be of subtype
- Does passing a string from Rust to Python like this cause memory leaks?
- Test FFI functions in Rust
- libllhttp-ext.bundle (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64h' or 'x86_64'))
- Is there a database of C function signatures?
- Passing va_list from rust variadic to C
Related Questions in C2HS
- Haskell FFi with c2hs: Better out-marshalling of structs
- What is the proper way to write doc for bindings?
- How to have c2hs working with ghc CPP extension?
- C2HS Pointer Type Correspondences
- c2hs in marshaller vs. gtk2hsC2hs
- Using alloca- with c2hs
- Haskell how to work with extern FILE* from c?
- Haskell FFI - return updated structure
- Asking stack to pass extra command-line arguments to c2hs
- How should I debug a "symbol X does not fit here" error when using c2hs?
- inline-c : "`Type` cannot be marshalled in a foreign call"
- Large c2hs-inferred size of C enum
- C2HS marshalling double pointer
- How to call a C function that uses a callback in Haskell?
- Error when trying to use a ForeignPtr argument to a dynamic wrapper
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Popular Tags
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
The size of enum is implementation-defined. The standard says:
BTW, in C++ one could specify the underlying type explicitly, e.g.: