1 2 3 4 5 6 7 8 9 | // NOTE(casey): Transient initialization Assert(sizeof(transient_state) <= Memory->TransientStorageSize); transient_state *TranState = (transient_state *)Memory->TransientStorage; if(!TranState->IsInitialized) { InitializeArena(&TranState->TranArena, Memory->TransientStorageSize - sizeof(transient_state), (uint8 *)Memory->TransientStorageSize + sizeof(transient_state)); |
This is in the code and build fine in the video but I get access violations as the TranState pointer fetched is garbage. because it should be (or at least that is what worked here)
1 2 3 4 5 6 7 8 9 | // NOTE(casey): Transient initialization Assert(sizeof(transient_state) <= Memory->TransientStorageSize); transient_state *TranState = (transient_state *)Memory->TransientStorage; if(!TranState->IsInitialized) { InitializeArena(&TranState->TranArena, Memory->TransientStorageSize - sizeof(transient_state), (uint8 *)Memory->TransientStorage + sizeof(transient_state)); |
the 3rd argument being how far we have eating our way into the TransientArena/TranState->TranArena
I did try to build the official day 85 code and it gives the same error as the code I have written along with.
Am I misunderstanding or is there some weird difference in our setups since it built on stream but not here?
Edit: I just want to know to save possible bug fixing in the future.