Questions tagged [destruction]

70 questions
1
vote
2 answers

Storing pixel based world data

I am making a 2d game with destructable terrain. It will be on iOS but I am looking for ideas or pseudocode, not actual code. I'm wondering how to store a large amount of data. (It will be a large world, approximately 64000 pixels wide and 9600…
Joshua Walsh
  • 1,676
  • 5
  • 21
  • 45
1
vote
0 answers

Execution order of global variable destructor and gcc attribute__((destructor))

This is a GCC specific issue. I'm encountering a werid issue in a .so library. The demo code of this .so library could be: __attribute__((init_priority(101))) std::unique_ptr global_object; __attribute__((constructor)) void…
xnervwang
  • 75
  • 5
1
vote
1 answer

QProcess on the loose

I have created two programs A and B. B is designed to be as a 32-bits QProcess started within a 64-bits A. These programs communicate nicely via stdin, stdout and QSharedMemory. A:A() { QProcess *p = new QProcess(this); …
Magnus
  • 13
  • 3
1
vote
2 answers

What is the difference between `__del__` and `__delete__`?

Suppose someone didn't know what the difference was between __del__ and __delete__? Write an explanation.
Samuel Muldoon
  • 1,081
  • 1
  • 15
1
vote
0 answers

Is there a way to tell if a C++ application is exiting?

I have some code that is in a c++ destructor, but I want it to do something different than normal if it is being destructed due to application exiting as opposed to a regular destruction. Is there a way to do this? More info: I have a logger object…
csm10495
  • 390
  • 4
  • 10
1
vote
1 answer

We initialize our main object, and it creates a new object in its constructor. When we destroy the main object, what happens to its creation?

I think the title is very specific, but here's some code to exemplify the question. Also, I realize that aggregation would be the right choice for this particular example, and maybe the question itself poses an OOP smell; however, while I am…
KeepAtIt
  • 139
  • 11
1
vote
2 answers

What happen when a lvalue assigned to a rvalue reference? No destruction of the temporary object?

#include using namespace std; #include class Word{ private: char* ptr = nullptr; public: Word(){ cout << "default constructor" << endl; } Word(const char* sentence):ptr{new…
1
vote
0 answers

Main function looping based on file called in a different class

Rookie here so please be nice!! I have had so much fun learning to program and gotten some great help along the way when google failed me. But alas, I'm stuck again. I have a C# program that looks like this (It's MWS if anyone is familiar) I've…
1
vote
2 answers

Cannot create class in AHK after destruction

I'm trying to wrap my head around classes in AHK. I'm C++ dev, so would like to make use of RAII (__New, __Delete), but it looks like I miss some concepts since things look very contra-intuitive for me. After some tries I came up with this simple…
Werolik
  • 876
  • 1
  • 8
  • 21
1
vote
3 answers

Destructuring declaration bug with the value

I can not understand why after destructuring assignment, items prop does not equal Gorilla. It will be used after deleting the main prop items: "Piggi" in the origin object options. I do not understand why... 'use strict'; let…
Sviat Kuzhelev
  • 1,635
  • 6
  • 20
1
vote
1 answer

static local variable destruction in plugin

I saw several questions about static local variable and static member of a class. From one comment in this and probably the most clear one link C++ Primer says: Each local static variable is initialized before the first time execution passes…
1
vote
1 answer

Destructive operations in scheme environments

I'm confused about destructive operations in Scheme. Let's say I have a list and some destructive procedures defined in the global environment: (define a '(a b c)) (define (mutate-obj x) (set! x '(mutated))) (define (mutate-car! x) (set-car!…
user1019830
1
vote
1 answer

vector does not erase content correctly (infite amount run of copy asignment operator untill crash [BEX])?

Well my problem is that after I want to "unload" loaded DLL's the copy assignmnent operator is called an unlimited amount of times until crash. The code from which I remove the vector data looks like this: void UnloadPlugins() { …
user1182183
1
vote
3 answers

Classes with static members containing static members in C++

I have a class which contains a static member 'obj'. The static class member obj itself contains a static member (which happens to be a mutex type of class). Now when my program terminates it is crashes. This happens when static object 'obj' gets…
Jeff
  • 11
  • 2
1
vote
2 answers

Handle object destruction on the stack

I'm currently writing a compiler front end for personal education on the topic and I've run into a problem concerning the way I handle BNF definition in C++ through operator overloading. Currently my setup is as follows: Rule.h: class…