4 ms·
> How is iostream any better than *printf? Type checking.
by msbarnett 11y ago
> How is iostream any better than *printf?
Type checking.
- duaneb 11y agoYou already have to do odd casting to get around compiler warnings when passing invalid types to a format—I don't buy this anymore.
- simoncion 11y ago> I don't buy this anymore. You should: https://news.ycombinator.com/item?id=10775022 https://news.ycombinator.com/item?id=10775022
- jmgao 11y agoprintf has type checking in every major compiler. You just need to annotate all of your printf-y functions with attributes to tell the compiler "this function does printf, the format string is the nth argument, and the format arguments start at the mth argument". It doesn't work with non-constexpr format strings, but there aren't many justifications for those.