cppcheck sept 18 redux

Chris Robinson chris.kcat at gmail.com
Tue Sep 22 09:46:42 CDT 2009


On Tuesday 22 September 2009 12:32:35 am Mike Kaplinskiy wrote:
> It actually does not dereference anything.

Does the C standard specify that taking the address of a struct member being 
dereferenced doesn't actually cause a dereference, instead just offsetting? 
Doing foo-> is identical to (*foo)., so dmW->dmFormName is the same as 
&(*dmW).dmFormName, which does technically cause a dereference, followed by 
taking the address of the field.

However, since GCC will remove deadcode and it's simple to see the dereference 
isn't needed, it just optimizes it away. I wouldn't even be surprised if this 
behavior is guaranteed by GCC with no optimizations enabled.. but I'm not so 
sure that it's guaranteed by the C standard. Is it?



More information about the wine-devel mailing list