[cfe-commits] r148823 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaExpr.cpp test/SemaObjCXX/fragile-abi-object-assign.m

Ted Kremenek kremenek at apple.com
Tue Jan 24 11:43:42 PST 2012


On Jan 24, 2012, at 11:33 AM, jahanian wrote:

> Suggestion is for fragile abi only. Nonfragile abi bans this altogether with no suggestions. Suggestion for fragile abi came from our runtime guy.
> I am not sure if there is any code out there which still uses fragile abi (specially with this assignment). But..., I will change the error.

Using memcpy is no better than the original assignment.  I think we should intentionally disallow an assignment copy because it is a bad idea to work with Objective-C objects in this way.  memcpy() commits the same sin, just in a different form.

Yes, I know using memcpy() is "safe", so is doing the original assignment.  It's still bad from a language design/consistency perspective, and is incompatible with the modern runtime (which is what we mostly care about these days).  My argument is that we should just make it illegal all the time and be done with it.  We shouldn't encourage users to use an alternate form of the same bad idiom that wouldn't work with the modern runtime.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120124/d5223d56/attachment.html>


More information about the cfe-commits mailing list