Question: I am trying to write a regular expression to allow all strings which matching a pattern but excluding few string following the same pattern 

for example: select all string start with site: but not (site:dev or site:corp)
what I have is ...

site:.\*[^!site:dev$][^!site:corp$]

this does not work if I test it for site:corps which is not exactly site:corp

can anyone help on this? [regex101](https://regex101.com/r/cGZAlc/1)

Answer: 
The chief risk is that the optimizer outright removes the call to `memcpy`. That's a perfectly reasonable optimization: the fastest code is code which isn't called, and it's safe to assume code isn't called with incorrect parameters. 

This also leads to the second risk: the optimizer may remove not just the `memcpy` call, but all code inevitably leading up to it. It may backtrack to a preceding `if` statement, observe which branch leads to the `memcpy`, and just remove that whole branch and the test condition too.
You can memcpy the objects back and forth as much as you want. The binary representation and alignment requirements of the structs are the same.

If you really don't believe it, you can create static\_asserts that check that the size and offsets are the same.