5 ms·
Is there such thing as 'simple sequential code'? Simple? Additions may overflow, printf may fail, etc. Usually code looks simple only because it ignores errors
by renox 8y ago
Is there such thing as 'simple sequential code'?
Simple? Additions may overflow, printf may fail, etc. Usually code looks simple only because it ignores errors..
As for sequential, we're in the age of multiple cores and GPUs..
- jstimpfle 8y agoOf course, sequential code is simple. Overflowing additions don't have anything todo with the code. They overflow or not. > Usually code looks simple only because it ignores errors.. No, it looks simple when the structure is right. There are other error handling strategies than "handle it now, or pop the stack frame and let your caller handle it now!". But with exceptions that's all the choice you are given (unless you convert them to regular data). Since exceptions strongly discourage alternative error handling schemes, no wonder they lead to unmaintainable code as soon as a considerable amount of conditions actually should be handled, instead of just bailing out. > As for sequential, we're in the age of multiple cores and GPUs.. What point are you trying to make? Obviously what I mean by sequential code here is that you can easily reason "if control flow reaches point A, then B will be executed, too".
- codebje 8y ago> > As for sequential, we're in the age of multiple cores and GPUs.. > What point are you trying to make? Obviously what I mean by sequential code here is that you can easily reason "if control flow reaches point A, then B will be executed, too". That goes out the door with any parallelism whatsoever, because control flow may reach point A in thread 1, but then thread 2 kills thread 1, and point B is never reached. It's increasingly hard to bury ones head in the sand and pretend every machine is a single-CPU single-task system with no interrupts.
- jstimpfle 8y agoSure, today's CPUs execute not only in parallel but also out-of-order. But that doesn't matter since threads don't let threads die before they've done their share. Out-of-order makes thread synchronization a little harder (when implementing lock-free algorithms for example), but that has nothing to do with exceptions.