@monorail goto pizza is the name of a pizza restaurant owned by programmers isn't it
@The_T probably not; goto considered harmful :P
@monorail I'm never going to learn how to program~
@vaporeon_ @The_T @monorail hi vaporeon do you use GOTO
@vaporeon_ @The_T @monorail i was curious if you had any strong feeling about it
i've only used GOTO in TI-BASIC because the menu feature requires it, other than that i dont use it out of habit since people tend to discourage its use nowadays
@wallhackio @vaporeon_ @The_T @monorail I think it's acceptable for error handing in some C stuff and derivatives (to the extent that C is acceptable), but in general I would frown on "backwards" goto that jumps into different functions or earlier in the same one just because it makes things hard to follow. (Except, as you mention, where there aren't really functions, in which case, sure, it's a jump, you need them.)
@aschmitz @wallhackio @vaporeon_ (i'm going to untag ti because they don't program and i don't want to bother them haha)
there are particular use cases where gotos are idiomatic and genuinely the best solution in sufficiently low-level languages but they're few and far between
one or two sneaking into your code so you don't have to refactor the whole goddamn thing, i get, but imo unless it's a particular idiom (as you say, error handling comes to mind) i think you should always be thinking "i'm wrong to do this". you can do it anyway, but you should at least know it's bad of you to do :P
@aschmitz @vaporeon_ @The_T @monorail C lets you jump between functions????
@aschmitz @vaporeon_ @The_T @monorail how are arguments from a function treated if you jump into it?
@wallhackio @aschmitz @monorail No, as far as I know? Unless you use setjmp()
/ longjmp()
, in which case the registers and such get saved in a jump buffer. But I've basically never had a need for setjmp()...
If I remember correctly, COBOL lets you just GOTO to a different function, though! I don't know how that's implemented, I've never actually programmed COBOL, I've only read about it...
@vaporeon_ @wallhackio @monorail Yeah, between functions is just in other languages, not C, sorry. (But yeah, more just "error handing is okay if you don't have better alternatives, limited forward use is less okay but can be understandable, and anything else you're just making spaghetti, unless it's the only flow control you have". I guess there are certain kernel-type constraints where it can be necessary too, though even there do it as little as feasible.)
@aschmitz @wallhackio @monorail May I ask which language you program in, that allows to GOTO between different functions?
I'm assuming it's something old, considering that most of the modern languages don't want to let you GOTO at all...
@wallhackio @The_T @monorail If I have any excuse to, then of course I do
Though that doesn't happen very often... And in my experience, if my code ends up having a lot of GOTOs, then that's because I am thinking wrongly about the logic and need to take a step back and find a better structure...