Bug 24429 – [ImportC] improve error message for size_t

Status
NEW
Severity
enhancement
Priority
P5
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2024-03-05T19:51:53Z
Last change time
2024-12-13T19:33:45Z
Keywords
ImportC
Assigned to
No Owner
Creator
Lance Bachmeier
Moved to GitHub: dmd#20414 →

Comments

Comment #0 by lance — 2024-03-05T19:51:53Z
If you compile C code that uses size_t, you'll get the error message: Error: undefined identifier `size_t` It would help to add something to that error message telling the user they need #include <stddef.h> in the C file. This is slightly confusing because size_t is built into D, so it's kind of surprising when DMD says it doesn't know what size_t is.
Comment #1 by alphaglosined — 2024-03-05T20:15:59Z
This should also apply to ptrdiff_t.
Comment #2 by lance — 2024-03-09T14:02:53Z
Same for NULL. The error message is incorrect: Error: undefined identifier `NULL`, did you mean `null`? But if you change it to null, you get Error: undefined identifier `null`. Maybe stddef.h should always be included with C code. There's not much in there, but what's there is used frequently.
Comment #3 by robert.schadek — 2024-12-13T19:33:45Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/20414 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB