[Issue 22877] New: importC: wrong sizeof for string literal

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Mar 11 19:06:56 UTC 2022


https://issues.dlang.org/show_bug.cgi?id=22877

          Issue ID: 22877
           Summary: importC: wrong sizeof for string literal
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: duser at neet.fi

int printf(char *, ...);
int main()
{
        printf("%d\n", (int)sizeof("a"));
}

this should print 2 (length of the string plus one), but right now it prints
the size of a pointer regardless of the string length

--


More information about the Digitalmars-d-bugs mailing list