<Alexander G. Riccio> via llvm-dev
2016-Mar-06 19:27 UTC
[llvm-dev] C-style casts in Allocator.h?
On a related note (to my last email, "MallocAllocator returns nonnull?"), I noticed that there are lots of C-style casts in Allocator.h; is there a reason to use C-style casts here? They make my eyes burn! I also wouldn't be surprised if they cause strange operator precedence issues for someone in the future. Example #1: char *Begin = (char*)alignAddr(*I, alignOf<T>());char *End = *I =Allocator.Slabs.back() ? Allocator.CurPtr : (char *)*I + AllocatedSlabSize; Example #2: DestroyElements((char*)alignAddr(Ptr, alignOf<T>()), (char *)Ptr + Size); Sincerely, Alexander Riccio -- "Change the world or go home." about.me/ariccio <http://about.me/ariccio> If left to my own devices, I will build more. ⁂ -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160306/f4e4940d/attachment.html>