0

Why isnt goto depreciated yet?

well, we are all taught not to use goto when learning c or c++, yet the libraries still allow you to use it. why so? I mean if you shouldn't use, just take the word out of the library, why keep it, and tell people not to use it.

3rd Nov 2016, 6:44 PM
Chinmay Bhale
Chinmay Bhale - avatar
1 Antwort
+ 1
goto can be replaced by statement that are more secure because "easier to understand". That's like pointer or new/delete that can sometime be replace be something that is supposed to produce less error/bug. But goto is still used sometume in low level programing or specific programming like on embedded devices. It's usefull on some case as it's easier to understand the code (less code + uniform + logic). As exemple it can be used in C when acquiring many ressource and have to manage all errors of each one and have to do it in order. I didn't really used it myself and don t know if it have an utility in c++ other than compatibility. There is some other statement that are even less used or most of the dev have never heard of but still here.
3rd Nov 2016, 7:30 PM
Kabe