zwoop commented on code in PR #13157:
URL: https://github.com/apache/trafficserver/pull/13157#discussion_r3236848887


##########
include/tscore/CryptoHash.h:
##########
@@ -44,7 +44,7 @@ union CryptoHash {
   uint8_t u8[CRYPTO_HASH_SIZE / sizeof(uint8_t)];
 
   /// Default constructor - init to zero.
-  CryptoHash() { memset(this, 0, sizeof(*this)); }
+  CryptoHash() { memset(static_cast<void *>(this), 0, sizeof(*this)); }

Review Comment:
   Claude had an interesting thought on this, not for now, but for future. 
Maybe he's right, and we could simplify this "core" class.
   
   ```
     The warning symptom is that a user-defined default constructor and
     user-defined copy-assignment make the union non-trivially-copyable even
     though every member is a `uint*_t` array. A cleaner long-term fix
     (master only — not for 9.2.x) would be to initialize `u64{}` in-class
     and default `operator=`, making the union genuinely trivially copyable
     and retiring the memset/memcpy entirely. Filing a follow-up on master is
     the right venue for that — this PR is the correct minimum for the
     release branch.
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to