www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Something odd in docs: printf: 32.5.2 size_t and ptrdiff_t

reply Cecil Ward <cecil cecilward.com> writes:
Re: possible bug in docs, in the following: see printf:

===
32.5.2 size_t and ptrdiff_t

These use the zd and dt format specifiers respectively:

int* p, q;
printf("size of an int is %zt, pointer difference is %td\n", 
int.sizeof, p - q);
===

The format specifiers don’t look right in the example, or am I 
missing the point?
Apr 30 2023
parent Petar Kirov [ZombineDev] <petar.p.kirov gmail.com> writes:
On Monday, 1 May 2023 at 00:50:37 UTC, Cecil Ward wrote:
 Re: possible bug in docs, in the following: see printf:

 ===
 32.5.2 size_t and ptrdiff_t

 These use the zd and dt format specifiers respectively:

 int* p, q;
 printf("size of an int is %zt, pointer difference is %td\n", 
 int.sizeof, p - q);
 ===

 The format specifiers don’t look right in the example, or am I 
 missing the point?
Thanks for pointing out these problems. I reviewed the example and opened a PR to fix it: https://github.com/dlang/dlang.org/pull/3594
May 01 2023