Re: [PATCH 1/2] introduce "banned function" list
- From
Jeff King <peff@peff.net>
- Date
- Jul 20, 2018, 00:55 UTC
- Message-ID
- <20180720005545.GB2179@sigill.intra.peff.net>
- In-Reply-To
- <CAPig+cTbvKZ6Ui_ib2g2Xqbv8zFwJp9idocbWaZLxj0Lpe+YBA@mail.gmail.com>
On Thu, Jul 19, 2018 at 05:59:47PM -0400, Eric Sunshine wrote:
Show 11 quoted lines
> > The one I brainstormed (but forgot to mention) is that it might be > > possible for a platform to have strcpy as a macro already? In which case > > we'd need to #undef it or risk a compilation error (even if the macro > > isn't actually used). > > I have some recollection (perhaps long outdated or just wrong) of > Microsoft headers spewing deprecation warnings about "unsafe" > functions. I don't know whether they did that by covering functions > with macros or by decorating the function with a deprecation attribute > or by some other mechanism, but such concern seems well-founded. > #undef'ing them might indeed be a very good preventative tactic.
Yeah, these functions are definitely on their "SDL banned list". I don't know how they implement that. At that level, I'd really expect it to be done with a deprecated attribute next to the declaration (I also considered trying to add deprecation attributes, too, but I think it's hard to do without re-declaring the function, and anyway it's "just" a warning).
-Peff