[Issue 22236] New: sizeof an empty C struct should be 0, not 1
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Tue Aug 24 08:18:59 UTC 2021
    
    
  
https://issues.dlang.org/show_bug.cgi?id=22236
          Issue ID: 22236
           Summary: sizeof an empty C struct should be 0, not 1
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: bugzilla at digitalmars.com
To match typical C compiler behavior. (The sizeof is 1 for C++.)
The following program will print 0 for C, 1 for C++. D currently regards both
as 1.
  #include <stdio.h>
  struct S { };
  int main() {
    printf("%d\n", sizeof(struct S));
  }
--
    
    
More information about the Digitalmars-d-bugs
mailing list