Liste des Groupes | Revenir à cl c |
Bonita Montero <Bonita.Montero@gmail.com> writes:Am 09.06.2025 um 17:53 schrieb Scott Lurndal:>Bonita Montero <Bonita.Montero@gmail.com> writes:>Am 09.06.2025 um 16:01 schrieb Scott Lurndal:
>Have you ever written real-world production code? Like an operating>
system, where allocation failures should -never- result in an
inability to recover.
If you need an allocation to proceed and it fails you can't recover.
That's your problem caused by poor design and implementation.
That's how 100% of all programs that deal with bad_alloc are designed.
>Exacerbated by the propensity for you to use C++ features that require>
dynamic allocation where other forms of data structures are more suitable.
When dynamic allocation is needed it is needed.
And there are many ways to handle it that don't include throwing
bad_alloc when the system is unable to provide additional address
space, memory or backing store.
>
Allocating major data structures at application start (perhaps using a
pool allocator) and crafting your algorithms such that they
don't require infinite memory is a good start.
Les messages affichés proviennent d'usenet.