4 ms·
A C programmer reading this list knows exactly why they are there. It is not at all a controversial list. Edit: I guess some down voter doesn't believe me but
by asveikau 7y ago
A C programmer reading this list knows exactly why they are there. It is not at all a controversial list.
Edit: I guess some down voter doesn't believe me but it continues to be true. They are all string functions. Most of them do not take an output buffer size, so a source string exceeding the destination buffer will overflow. Others, like strncpy, take an output buffer size but will not null terminate when exceeded, so the buffer size must be reduced by 1 by the caller and potentially manually terminates, which is too easy to not consider. But any C programmer with significant experience already knows these pitfalls. So it's not controversial.
- noname120 7y agoThat's gatekeeping. If a junior developer starts working on this project they might bother a more senior developer who has better things to do with their time, or inline the definition of one of the functions out of frustration.
- noname120 7y agoI'd be interested in knowing which part of the comment you don't agree with and why.
- philwelch 7y agoGit, like the Linux kernel, is essential, basic infrastructure that everybody uses and that needs to remain reliable. It's not a volunteer training project for dilettantes and neophytes. Gatekeeping is a deliberate part of how these projects are run and the results speak for themselves.
- noname120 7y agoMakes sense, thanks for taking the time to answer.
- magnetic 7y agoYou explained it in 2 lines that would make for great comments. It seems useful to educate C programmers who don't have "significant experience" because, well, by definition, not every C programmer has "significant experience" and they are the ones who would benefit most from learning this. It's not about being controversial: nobody's going to disagree with your explanation (it is what it is - it's not an opinion).
- asveikau 7y agoI don't remember how I learned this. But it happens pretty naturally working with C a lot and doing things like reading documentation and code. To be clear this is not elitism or something of the sort, I am not at all pessimistic that new people won't learn it. It just needs to happen in its due time. So I would say... What good is a verbose comment to explain? Somebody who doesn't instantly understand why it's banned can read the big warnings on the manpage, or they can google it and land on good explanations on sites like Stack Overflow, or they can look at the function signatures and come up with a correct guess. Then boom. They know. And from there they can assess other interfaces and see if they suffer the same weakness. This ability tends to come from simple exposure.
- bhk 7y agoIf every C programmer knew, then there would be no need to ban them
- asveikau 7y agoI actually wonder why they do it. Linkers already warn for this stuff. Doing it this way requires every source file to include banned.h, which I would guess is done by including it from some other common header, but that's not fool proof either.
- ncmncm 7y agoNot knowing defines you as not a C programmer. That doesn't stop many people from trying to code C anyway... I have seen strtok used, even though it takes more code to use it correctly than not use it. strlcpy is like that, too. Of course, what happens is nobody uses them correctly.
- Dylan16807 7y agoThat's not true. People don't staunchly avoid situations that have pointless sharp edges. Putting up caution tape, despite everyone being aware of the danger, is very often a useful activity.
- ikeyany 7y agoFYI that response insinuates that noname120 is not a C programmer...
- MrStonedOne 7y agoI'm a c programmer, I'm reading this list, I don't know why they are there. You. Can. Not. Call. Yourself. Open. Source. If. You. Gatekeep. Your. Contributors.
- mhh__ 7y agoI think you can. The whole point of being open source and using a project like cough git (since we're here), is that if you don't like it you can fork it. If you don't allow forks then I agree you aren't open source
- philwelch 7y agoLooks like they did.
- Merg 7y agoJust open the docs. Seriously, first link in Google/DDG/Bing on topic of "<any c string routine> safety" will explain it to you. I am self-taught and I can see it. Seriously, just looking at function arguments shows you, there is a problem under the hood. Reading docs also will point out. It is open-source, read and learn from Git, Linux code and so on. If you do not have experience is sysdev or high security, just don't contribute there. This is like saying, construction engineering is gatekeeping beginners, because you have to work for few years before you can start your own project.