top | item 7342778

(no title)

EddSeabrook | 12 years ago

C doesn't have exceptions, so goto is commonly used to emulate that style of programming.

discuss

order

thrownaway2424|12 years ago

It's not just that, it also doesn't have automatic destruction of objects, so any local array or structure containing a pointer needs to be laboriously freed by hand.

And in other words, nobody should be writing anything in C. Ever. The need to be compatible with programs written in C violates my rule against writing anything in C and is therefore not a valid reason to write crypto stacks in C.

pktgen|12 years ago

> And in other words, nobody should be writing anything in C. Ever.

And in other words, nobody should be listening to thrownaway2424. Ever.

cesarb|12 years ago

Pure C does not have automatic destruction of objects, but gcc has an extension to do it. Take a look at systemd's source code to see it in action. It's very similar to C++'s RAII, and can also do things like closing file descriptors.

deletes|12 years ago

You realize that most lower things are written in or base on C, right.

72deluxe|12 years ago

It's amusing but I never thought of exceptions as gotos. But that's what they in essence.

ksk|12 years ago

How are exceptions like gotos? I don't see any similarity. If by "essence" you mean they jump to a specific line of code, then lots of things can do that - switch/case , if/else, do/while, function calls/returns, etc.