Re: another -Wunsequenced topic

看板FB_current作者時間12年前 (2013/07/09 16:32), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串6/6 (看更多)
--Apple-Mail=_5A46FA65-E6BA-4461-97EE-481C88DB19C4 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On 9 Jul 2013, at 05:40, Tim Kientzle <tim@kientzle.com> wrote: > However, this does have an implicit redundant store, > so changing it to >=20 > ptr =3D func(ptr + 1); >=20 > is still a good idea, just not for the reason Clang was claiming. If the compiler can tell that ptr has not escaped, then it will elide = the redundant store (typically, it will be gone as long as ptr is a = local and its address has not been passed out of the function), so there = should be no change to the generated code. However, I still agree that it is good style, because if I read the = original code I would be left wondering what the original programmer = expected the incremented value of ptr++ to be visible to and suspect a = more subtle error. =20 David --Apple-Mail=_5A46FA65-E6BA-4461-97EE-481C88DB19C4 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.18 (Darwin) Comment: GPGTools - http://gpgtools.org iQIcBAEBAgAGBQJR28YYAAoJEKx65DEEsqIdj6gP/jdC6pgahOjH/rP+cKoSuo2p Z5S3BcaFn7d0VNeqFxN29lxfqjvnqwXLcZg2G/p7u4Vkn78sXwUNqX9XjIk5QmVY 5LQ1qez6QLrpPKcmwC3yHaKuiPm0yThy4I/v/sRmEXgkFYw4JMuvOsfq0aWO4guj h7CtRXHkvxH7xx5RY4miWnow76W39IUSZFbidSWYmDydHrzIy/zgBzlQgnWg7NWI GGa6ESM7L7/1EQ61jSSBGxlW39Rfw8qQsBsrpg61rQs/7u/ZpKNpS9x3Cqy7npww eqwCePVa6DeVMYJgd3Lx8TNOR7jND7qjw4GcsLBk5zXK5lkpyK1tVc1AlL4eiEJJ wPiq91SIvwJgoNUT2qGYhlAxrDCqtkucPK46MG2hOD+tAv0FCCZKTcF/VtjA12uP eQnPDwyAIDHDGWJVBuRMny7mMv4jn+TpHIe1D+5NNYkQw8kPUbqCddsRgj3hJfaA og9hoV3EhKEbJTS574XjPw7AQaJrosJR8sRTKcm/fjMbEn7xylw0B0CU+NK/eH9s lQvBWRPwldzYONRq6FCMyaKMSD8U1ZsMQMg82hjN53e16PYU8dZGrkrxFU3OhBWf yFxeqWM5ez0x3YK/3lG7lqgDqzYm3m3IzdLfaogz/4ksdj4uzdObueCfnqVJCRBz 2dfonQ6HcbHM2B5H81/j =qg4B -----END PGP SIGNATURE----- --Apple-Mail=_5A46FA65-E6BA-4461-97EE-481C88DB19C4--
文章代碼(AID): #1Hsyg2LL (FB_current)
文章代碼(AID): #1Hsyg2LL (FB_current)