3 ms·
Format Specifiers Checking in Visual Studio 2015
- Animats 11y agoThat's been in GCC since, what, 2003? [1] [1] https://gcc.gnu.org/onlinedocs/gcc-3.2/gcc/Function-Attributes.html https://gcc.gnu.org/onlinedocs/gcc-3.2/gcc/Function-Attribut...
- cremno 11y agoYes, it really took them quite some time to make this a compile-time diagnostic. But before you could've used the static analyzer (/analyze). However GCC's format attribute doesn't work with wide character functions (which is important on Windows) and the produced diagnostic doesn't suggest a correction.
- maxlybbert 11y agoI was tempted to make the same comment. But that enforces the idea that the first team to implement a feature is the only team ever allowed to mention it.
- cjensen 11y agoTo me, it's as if a Car Manufacturer proudly announced the inclusion of anti-lock brakes on this year's model. It's nice that they're including this safety feature, but it's embarrassingly late compared to others. Worse, for formatter-warnings, we needed them badly 20 years ago when all we had were printf-style functions. There's little need for them in modern C++.
- to3m 11y agoI'm pretty sure printf warnings were there in djgpp for DOS, which would put it to at least 1996. It must have taken actual effort to ignore this feature for so long :) On the other hand, gcc's equivalent of pragma optimize is a comparatively recent addition! - and I know which one has caused me more heartache over the years (hint: not format strings).
- jblow 11y agoThis has actually been in Microsoft's C compiler for along time, too. (The one that is mostly only C89). It is an embarrassing situation really.