If I have a global pointer, and I initialize it like this:
Image *fbPtr = NULL;
...
void initFrameBuffer(const BootInfo::FrameBuffer &info) {
Image fb(info.getWidth(), info.getHeight(), info.getBpp(), info.getBuf());
fbPtr = &fb;
}
Would it be undefined behaviour? Would the fb variable be deleted by the end of the function and the pointer be rendered invalid? I'm using GCC10 and compiling with -std=c++2a, if it makes any difference.