Re:Formatting Text in C++: The Old and the New Ways
by 38 on Saturday September 16, 2023 @04:32PM
(#37538425)
saying "dont use" something isn't really actionable, unless you give a safe alternative.
[ Parent
| on HN ]
Re:Formatting Text in C++: The Old and the New Ways
by thiht on Saturday September 16, 2023 @05:30PM
(#37538905)
And explain why it’s not safe too
Re:Formatting Text in C++: The Old and the New Ways
by jjnoakes on Saturday September 16, 2023 @05:54PM
(#37539120)
The safe alternatives are in the article.
Re:Formatting Text in C++: The Old and the New Ways
by cozzyd on Saturday September 16, 2023 @09:43PM
(#37540655)
asprintf is often a better choice if you're heap allocating anyway. For a static or stack buffer, obviously snprintf, unless you know the maximum possible length won't exceed (which you often do....).