Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Why don\t we replace all the goto\s with C exceptions?

exceptions replace
0
Posted

Why don\t we replace all the goto\s with C exceptions?

0

• (REG) Admittedly, all those goto”s do look a bit ugly. However, they are usually limited to error paths, and are used to reduce the amount of code required to perform cleanup operations. Replacing these with Politically Correct if-then-else blocks would require duplication of cleanup code. So switching to if-then-else blocks might be good Computer Science theory, but using goto”s is good Engineering. Since the Linux kernel is one designed to be used, rather than to demonstrate theory, sound engineering principles take priority. So now we come to the suggestion for replacing the goto”s with C exception handlers. There are two main problems with this. The first is that C exceptions, like any other powerful abstraction, hide the costs of what is being done. They may save lines of source code, but can easily generate much more object code. Object code size is the true measure of bloat. A second problem is the difficulty in implementing C exceptions in kernel-space. This is convered in

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123