Re:The Two Factions of C++
by bluGill on Monday November 25, 2024 @09:32AM
(#42236587)
That depends on your problem. I've seen useful state machines. I've seen someone implement a simple decoder as a complex any-to-any state machine that couldn't be understood - a single switch statement would have been better. Nothing about state machines, but some people have a hammer and are determined to prove it can drive any screw - it works but isn't how you should do it.
[ Parent
| on HN ]
Re:The Two Factions of C++
by jimmaswell on Monday November 25, 2024 @12:56PM
(#42238395)
I've adopted a rule of thumb to have a very low bar to skip straight to writing a state machine. I've never once regretted it, personally. I'm sure they can be misused but I haven't came across that.
Re:The Two Factions of C++
by garethrowlands on Monday November 25, 2024 @02:39PM
(#42239434)
Switch + goto is the classic way to implement a state machine in C.