diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-06-11 13:54:17 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-06-11 14:02:10 +0300 |
commit | b763c34e80d3b20f9a7f0a592e479e5fa7ab295f (patch) | |
tree | 0e55888e504996493313f5351204d6c1e049a5db /intern/cycles/bvh | |
parent | a6e582164f11c618a324dad1a2ae2c73cbc85b77 (diff) |
Cycles: Cleanup, silence strict compiler warning
There is one legit place in the code where memcpy was used as an
optimization trick. Was needed for older version of GCC, but now
it should be re-evaluated and checked if it still helps to have
that trick.
In other places it's somewhat lazy programming to zero out all
object members. That is absolutely unsafe, at the moment when
less trivial class is used as a member in that object things
will break.
Other cases were using memcpy into an object which comes from
an external library. We don't control that object, and we can
not guarantee it will always be safe for such memory tricks
and debugging bugs caused by such low level access is far fun.
Ideally we need to use more proper C++, but needs to be done with
big care, including benchmarks of each change, For now do
annoying but simple cast to void*.
Diffstat (limited to 'intern/cycles/bvh')
-rw-r--r-- | intern/cycles/bvh/bvh_params.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/intern/cycles/bvh/bvh_params.h b/intern/cycles/bvh/bvh_params.h index 89a379cf356..d8dd7df6ba1 100644 --- a/intern/cycles/bvh/bvh_params.h +++ b/intern/cycles/bvh/bvh_params.h @@ -182,7 +182,10 @@ public: BVHReference& operator=(const BVHReference &arg) { if(&arg != this) { - memcpy(this, &arg, sizeof(BVHReference)); + /* TODO(sergey): Check if it is still faster to memcpy() with + * modern compilers. + */ + memcpy((void *)this, &arg, sizeof(BVHReference)); } return *this; } |