Hacker News .hnnew | past | comments | ask | show | jobs | submitlogin

That is anything but an uncommon stance.


And most of it seems to stem from the old "goto considered harmful" that has been spread from generations to generations.

gotos have a pretty important niche in error handling blocks. You can see them all over the linux kernel, arguably one of the biggest (and most successful) C projects out there.


We're talking about flight software, not software in general. Implying that the people who drafted this guideline were blindly accepting dogma is simply wrong. Look at the list of contributors (page 5) -- it includes Ritchie, Kernighan, and Doug McIlroy -- in addition to several others who have spent their careers writing flight software.


for C? it's very commonly used to jump to implement "catch" (jump to clean-up on error).


Yes, but there are other ways to implement error handling -- and a ban on gotos is a lot easier to check and enforce than a ban on just "bad" gotos.


goto is commonly used that way in C... and it is just about as commonly straight up banned in C.

I am not defending the bans, but find it strange that people would be surprised by them.


> I am not defending the bans, but find it strange that people would be surprised by them.

yes, i think a lot of replies here are speaking past each other, making valid and not actually contradictory points, but not really replying to each other.

if you read the entire doc it is clear that they are pushing c in a very safe, but somewhat unusual direction. there's no dynamic memory for example, so the main reason that most of my c code uses goto - to free memory on failure in a "catch" - is irrelevant.

taken as a whole, it's not what i would call normal c use, and i don't think it's very useful for most other people as a guideline, but it is internally consistent and, for the specific use case, reasonable.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: