www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22877] New: importC: wrong sizeof for string literal

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 puremagic.com
          Reporter: duser 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

--
Mar 11 2022