Re: [PATCH 1/2] introduce "banned function" list
- From
Elijah Newren <newren@gmail.com>
- Date
- Jul 20, 2018, 17:48 UTC
- Message-ID
- <CABPp-BGt2EEW4aFt8TYyy1fATPRW2rnNxpMuGcS0YR_gqs3=ig@mail.gmail.com>
- In-Reply-To
- <CACsJy8BxXyY6h8iN-RExBHASB6FkFLKDkrE_h+gH0A1k2tVd6w@mail.gmail.com>
On Fri, Jul 20, 2018 at 7:41 AM, Duy Nguyen <pclouds@gmail.com> wrote:
Show 15 quoted lines
> On Thu, Jul 19, 2018 at 10:40 PM Jeff King <peff@peff.net> wrote: >> >> There are a few standard C functions (like strcpy) which are >> easy to misuse. We generally discourage these in reviews, >> but we haven't put advice in CodingGuidelines, nor provided >> any automated enforcement. The latter is especially >> important because it's more consistent, and it can often >> save a round-trip of review. >> >> Let's start by banning strcpy() and sprintf(). It's not >> impossible to use these correctly, but it's easy to do so >> incorrectly, and there's always a better option. > > Is it possible to extend this to ban variables as well? I'm still > going to delete the_index from library code. Once that work is done I
Or perhaps constants, such as PATH_MAX to avoid problems like this one from 2.18.0 timeframe: https://public-inbox.org/git/7d1237c7-5a83-d766-7d93-5f0d59166067@web.de/