Skip to main content
10 events
when toggle format what by license comment
Feb 5, 2016 at 15:35 comment added Brian @Praxeolitic: Actually, this does exist. You'll want to listen for the WM_POWERBROADCAST message. This only works if your computer is battery-powered (if you're using a laptop or a UPS).
Jan 31, 2016 at 9:55 comment added Stack Exchange Broke The Law @Praxeolitic No, your software needs to not corrupt data during a power failure. And if you can manage that, you can also manage to not corrupt data after an unhandled exception.
Jan 31, 2016 at 9:00 comment added Praxeolitic @immibis Huh? My software needs to cleanly shutdown during a power failure now? That's going to be tricky... at least until SIGPOWEROUTAGE gets implemented...
Jan 31, 2016 at 6:57 comment added Stack Exchange Broke The Law If you have some resources that really needed to be restored by a destructor call, then your program will break in the event of a power failure. You should probably fix that.
Jan 30, 2016 at 14:45 comment added Matthieu M. @Praxeolitic: I am saying that not all crashes unwind the stack, for example std::abort does not and thus failed assertions don't either. It's also worthwhile to note that on modern OSes, the OS itself will cleanup a lot of resources (memory, file handles, ...) which are tied to the process ID. Finally, I was also hinting at "Defense in Depth": it's unreliable to expect that all other processes are bug-proof and will always release the resources they acquired (sessions, nicely finish writing files, ...) you have to plan for it...
Jan 30, 2016 at 14:34 comment added Praxeolitic @MatthieuM. Are you saying that destructors are not a good place for resource cleanup that should occur even during a crash?
Jan 30, 2016 at 14:29 vote accept Praxeolitic
Jan 30, 2016 at 13:46 comment added Matthieu M. If you have some resource that really needed to be restored by a destructor call, you're in a pickle... => Given that (unfortunately) C++ is quite crash-prone, and that's without mentioning that the OS might decide to kill your program at any time (OOM killer in Unix for example), your program (and its environment) need be tailored to support crashes.
Jan 30, 2016 at 13:30 review First posts
Feb 2, 2016 at 22:30
Jan 30, 2016 at 13:27 history answered erlc CC BY-SA 3.0