haskell / haskell/c2hs

{#sizeof#} returns incorrect value

Open
#175 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
211
Forks
52
PR merge metrics
No merged PRs in 30d

Description

I'm using [this](https://github.com/nfc-tools/libnfc/blob/e9a750fc005fc545e731c9e063e2840f7ee4049e/include/nfc/nfc-types.h) include file and the following Haskell source:

```haskell
module Test where

#include "nfc-types.h"

{#sizeof nfc_iso14443a_info#}
```

The output of c2hs is:

```haskell
-- GENERATED by C->Haskell Compiler, version 0.28.1 Switcheroo, 1 April 2016 (Haskell)
-- Edit the ORIGNAL .chs file instead!

{-# LINE 1 "test.chs" #-}
module Test where

296
{-# LINE 5 "test.chs" #-}
```

But when I compile the following program:

```c
#include

#include "nfc/nfc-types.h"

int main() {
printf("%lu\n", sizeof(nfc_iso14443a_info));
return 0;
}
```

The output is:

```
$ ./a.out
283
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.