First Draft: Making printf @safe

Nick Treleaven nick at geany.org
Wed Jul 17 10:31:08 UTC 2024


On Wednesday, 17 July 2024 at 00:42:03 UTC, Walter Bright wrote:
> https://github.com/WalterBright/documents/blob/ed4f1b441e71b5ac5e23a54e7c93e68997981e9a/SafePrintf.md

> This DIP applies to any function marked with pragma(printf) and 
> @safe or @trusted.

So how does `printf` benefit from this then? It can't be marked 
`@trusted`. Would we add a `@trusted` overload taking a string 
format parameter and use non-C variadic arguments?

The overload would have to handle the cases in this DIP itself. 
Or we could use an [enum 
parameter](https://forum.dlang.org/post/jhondvrsvvvrwjkympjb@forum.dlang.org) as the format string, if we had those.


More information about the dip.development mailing list