tag:blogger.com,1999:blog-3218008772058347246.post2733620268118637833..comments2024-03-21T09:32:41.471+02:00Comments on Robert Gawron: Access to object's fields by using pointer arithmeticUnknownnoreply@blogger.comBlogger2125tag:blogger.com,1999:blog-3218008772058347246.post-80171159729338741132011-02-24T20:50:02.037+02:002011-02-24T20:50:02.037+02:00Hi Alex,
that would be some improvement, but I th...Hi Alex,<br /><br />that would be some improvement, but I think, that this code can't be really fixed. It will always be vulnerable to changing order of fields in class and will fail silently in this case (but will compile and probably won't crash, just will work incorrectly).<br /><br />regards,<br />RobertRobertGawronhttps://www.blogger.com/profile/10392172189489700514noreply@blogger.comtag:blogger.com,1999:blog-3218008772058347246.post-14668816340591646122011-02-24T07:53:32.645+02:002011-02-24T07:53:32.645+02:00it can be unsafe. as i undestood 2 integers take 2...it can be unsafe. as i undestood 2 integers take 2 bytes and follow by description. what if another compiler will set more space for int? maybe it is better to use "2*sizeof(int)" instead of "2", but i can be wrong, of course ;)Unknownhttps://www.blogger.com/profile/01069720630053570678noreply@blogger.com