Registriert seit: 24. Sep 2022
Ort: Planet Erde
356 Beiträge
Delphi 11 Alexandria
|
AW: GNU C++ - wie Speicherfehler abfangen ?
14. Aug 2024, 19:52
@Kas Ob.
it seem so.
But like I can see, that QChar is a class, with members like "bool isDigit()".
And me, when I have understand you, it should possible for C++ to "delete foo;", too.
When "foo" is not a Pointer (also when a Pointer to the class TuFoo exists:
auto * fifi = new TuFoo();
then you can delete it without problems.
I the simmilar same way, you can do: auto * fifi = new int;
which give you a "global" fifi reference, that over life the calling stack (it will also
accessible outside).
So, it should not be a Problem, that I i "free" the allocated memory (under 64-Bit there are
8 Bytes).
An other thing is it, if you use class references or integer references in the local scope
(without allocating static memory with "new").
So, class TuFoo fifi;
will automatically clean/free, if the callee function reach the Epilog.
Frag doch einfach Alles was nicht programmiert werden kann, wird gelötet
|