Skip to content

Commit

Permalink
Add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Julian LALU committed Dec 19, 2024
1 parent e8947bb commit ee81c91
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions interface/core/memory/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,8 @@ namespace hud
check(destination != nullptr);
memset(destination, value, size);
// Prevent compiler from removing the memset
// Add a volatile pointer to the memory and reaffect it to destination
// This prevent memset to be remove if the user don't use return value
volatile unsigned char *p = (volatile unsigned char *)destination;
destination = (void *)p;
return destination;
Expand Down

0 comments on commit ee81c91

Please sign in to comment.