Skip to content

Commit f6a6d49

Browse files
authored
Fix issue 23872 - Wrong example in Interfacing to C, calling printf (#3594)
1 parent f7f8b13 commit f6a6d49

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

spec/interfaceToC.dd

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,13 +259,16 @@ printf("hello %.*s\n", cast(int) s.length, s.ptr);
259259

260260
$(H3 `size_t` and `ptrdiff_t`)
261261

262-
$(P These use the `zd` and `dt` format specifiers respectively:
262+
$(P These use the `zu` and `td` format specifiers respectively:
263263
)
264264

265+
$(SPEC_RUNNABLE_EXAMPLE_RUN
265266
---
266-
int* p, q;
267-
printf("size of an int is %zt, pointer difference is %td\n", int.sizeof, p - q);
267+
import core.stdc.stdio : printf;
268+
int* p = new int, q = new int;
269+
printf("size of an int is %zu, pointer difference is %td\n", int.sizeof, p - q);
268270
---
271+
)
269272

270273
$(H3 Non-Standard Format Specifiers)
271274

0 commit comments

Comments
 (0)