www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22607] New: ImportC misses some float values ending with f

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

          Issue ID: 22607
           Summary: ImportC misses some float values ending with f
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: lance lancebachmeier.com

This code (taken from stb_easy_font.h) fails to compile:

for (j=0; j < 4; ++j) {
  * (float *) (vbuf+offset+0) = x + (j==1 || j==2 ? (vertical ? 1 : len) : 0);
  * (float *) (vbuf+offset+4) = y0 + ( j >= 2 ? (vertical ? len : 1) : 0);
  * (float *) (vbuf+offset+8) = 0.f;
  * (stb_easy_font_color *) (vbuf+offset+12) = c;
  offset += 16;
}

Error: `f` is not a member of `int`

0.f wouldn't work in D, but 0.f apparently compiles with C. Even if there's
some reason this shouldn't compile, the error message doesn't make sense for C
code.

--
Dec 18 2021