<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Aug 6, 2012, at 5:42 PM, Jordan Rose wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><meta http-equiv="Content-Type" content="text/html charset=us-ascii"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Aug 6, 2012, at 17:37 , Fariborz Jahanian <<a href="mailto:fjahanian@apple.com">fjahanian@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><br>On Aug 6, 2012, at 5:09 PM, Jordan Rose wrote:<br><br><blockquote type="cite">Why does this only warn under non-GC?<br></blockquote><br>I don't know. This is an old GCC option and brought it over as-is to clang. I don't have the original gcc radar<br>to look for the rational. Could be that under GC it is safe to do direct assignment while with the advent of<br>properties, users warn to catch such accesses and use the property syntax which controls the ivar<br>access with its own APIs (think atomic vs non-atomic).<br></blockquote></div><br><div>The same is true under ARC, though. If this is a safety warning, it only really needs to be on for MRC and __unsafe_unretained ivars. I think it's more often a consistency thing, though: if you want Key-Value Observing to work right you have to use the properties.</div><div><br></div><div>As a heuristic, people often access ivars directly in -init methods and in -dealloc, since properties may be overridden by subclasses. If we were going to split the difference on the warnings, it could be on by default everywhere <i>except</i> -init and -dealloc methods.</div></div></blockquote><br></div><div>My intention was to closely follow gcc's behavior wrt -Wdirect-ivar-access. In r161426 I have added to ignore arc for this class of warnings. </div><div>arc already issues numerous</div><div>warnings on unsafe assignment to ivars and this option is not in the scope of what is was meant for. I made one change based on your</div><div>comment though and it is to allow direct ivar access in init/dealloc families.</div><div><br></div><div>- Fariborz</div><div><br></div><br></body></html>