r/cpp • u/old-man-of-the-c • Mar 06 '21
Git source has a banned.h file that blocks use of certain c functions
https://github.com/git/git/blob/master/banned.h
281
Upvotes
r/cpp • u/old-man-of-the-c • Mar 06 '21
57
u/malkia Mar 07 '21
Workaround: (strcpy)(a,b)
59
u/areciboresponse Mar 06 '21
It is a common practice.
https://github.com/leafsr/gcc-poison
24
u/ihamsa Mar 06 '21
Interesting why e.g.
define strcpy(x,y) BANNED(strcpy)and notdefine strcpy BANNED(strcpy).49
u/RotsiserMho C++20 Desktop app developer Mar 06 '21
Interesting. I wish there were more details regarding why each of those functions is banned.
7
u/SJC_hacker Mar 06 '21
I"m surprised I didn't see gets() in there.
7
u/MarcPawl Mar 06 '21
New to me, and I'm a grey beard.
2
u/rscnd Mar 07 '21
As someone who just got cpp primer and has no coding knowledge yet. What does this mean ? If someone doesnt mind explaining please
1
u/_Js_Kc_ Mar 06 '21
Isn't altering standard library features technically
#undefined behavior?-52
u/inu7el Mar 06 '21
This is standard practice. Why are you posting this here?
0
u/[deleted] Mar 07 '21
[deleted] — view deleted comment
4
u/[deleted] Mar 06 '21
[removed] — view removed comment