c2hs icon indicating copy to clipboard operation
c2hs copied to clipboard

{#sizeof#} returns incorrect value

Open centromere opened this issue 9 years ago • 1 comments

I'm using this include file and the following Haskell source:

module Test where

#include "nfc-types.h"

{#sizeof nfc_iso14443a_info#}

The output of c2hs is:

-- 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:

#include <stdio.h>

#include "nfc/nfc-types.h"

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

The output is:

$ ./a.out 
283

centromere avatar Dec 09 '16 00:12 centromere

Probably a duplicate of #172, since that header uses #pragma pack.

ian-ross avatar Dec 09 '16 05:12 ian-ross