This is super historical. We chose not to use exceptions because we were worried that they were "slow". That's largely just not true anymore. IMHO, exceptions definitely have their place. They're super useful when dealing with rare error cases that need to fail a deep call tree. They can reduce the number of lines of code by a ton. There are pitfalls and people need to know what they're doing (i.e. don't throw in a destructor).
Nate On Wed, May 10, 2017 at 9:36 AM, Andreas Sandberg <[email protected]> wrote: > Having had a quick look at the code, I'd say that exceptions could > definitely make sense. I would support limited use of exceptions where > it makes sense to make the code flow less entangled. Initially, I would > argue that we should keep exceptions local to SimObjects (interfaces > like ports should never have to deal with exceptions) and only be used > for recoverable errors (e.g., unexpected input that should result in a > warning). > > Are there any technical reason why we aren't using exceptions? > > //Andreas > > > On 10/05/2017 08:25, Gabe Black wrote: > >> This would be internal to the gdb code, ie if a read from the socket >> fails, >> it would detach and throw an exception which would unwind back out of all >> the gdb stuff without having to add ifs all over the place. This bit of >> code doesn't really have an external interface, so it wouldn't be visible >> to the caller, assuming a stray exception didn't escape somehow. I think >> it >> would be a little nicer that way, but not so much that I'd want to argue >> for it very strongly. >> >> Gabe >> >> On Wed, May 10, 2017 at 12:09 AM, Andreas Hansson < >> [email protected]> >> wrote: >> >> Hi Gabe, >>> >>> I do not think adding exceptions will make things any less cluttered. It >>> will simply move that complexity to any caller, will it not? I am not a >>> fan of exceptions in general as it mucks with the control flow. >>> >>> Andreas >>> >>> On 10/05/2017, 07:31, "gem5-dev on behalf of Gabe Black" >>> <[email protected] on behalf of [email protected]> wrote: >>> >>> Hi folks. I have a change to make the GDB stub in gem5 a bit less >>>> fragile: >>>> >>>> https://gem5-review.googlesource.com/#/c/3180/ >>>> >>>> Unfortunately that involved adding a lot of error code checking which >>>> makes >>>> things a bit cluttered and ugly. I think it would be a lot nicer to use >>>> exceptions, but I remember those being a no-no. Are they currently >>>> against >>>> the rules, or could I use them to make that code a bit nicer? >>>> >>>> Gabe >>>> _______________________________________________ >>>> gem5-dev mailing list >>>> [email protected] >>>> http://m5sim.org/mailman/listinfo/gem5-dev >>>> >>> IMPORTANT NOTICE: The contents of this email and any attachments are >>> confidential and may also be privileged. If you are not the intended >>> recipient, please notify the sender immediately and do not disclose the >>> contents to any other person, use it for any purpose, or store or copy >>> the >>> information in any medium. Thank you. >>> _______________________________________________ >>> gem5-dev mailing list >>> [email protected] >>> http://m5sim.org/mailman/listinfo/gem5-dev >>> >> _______________________________________________ >> gem5-dev mailing list >> [email protected] >> http://m5sim.org/mailman/listinfo/gem5-dev >> > > IMPORTANT NOTICE: The contents of this email and any attachments are > confidential and may also be privileged. If you are not the intended > recipient, please notify the sender immediately and do not disclose the > contents to any other person, use it for any purpose, or store or copy the > information in any medium. Thank you. > _______________________________________________ > gem5-dev mailing list > [email protected] > http://m5sim.org/mailman/listinfo/gem5-dev > _______________________________________________ gem5-dev mailing list [email protected] http://m5sim.org/mailman/listinfo/gem5-dev
