Only it doesn't, prevent array access p[1] =3D 3; p + 1 =3D 2; don't fail (there is no assignment to the value of p) On 2012-10-10 09:32, Isaac Marino Bavaresco wrote: > Em 10/10/2012 10:09, Anthony Toft escreveu: >> But why? (the bane of my parent's existence) >> >> p++; only increments the value of the pointer on the stack, not the >> original pointer (&myInt or &anotherInt) nor the contents of the >> pointer. >> >> Here at work (I am 18 years into a software engineering career) I=20 >> see >> examples of unnecessary const-ness all over the place, it causes any >> amount of trouble! The only time I have ever needed a =20 >> is >> because of overzealous use of const parameters, the compiler will=20 >> not >> remove const-ness without express permission, unlike adding it. >> >> Now, on the other hand, pointers to const objects or values ie=20 >> "const >> int *p" I feel is an excellent idea, but once again, it's not the >> calling function saying "I won't allow him to change this" it's the >> called function saying "I promise I won't change it" > > > Useful to prevent the callee function from using the pointer as a > pointer to an array when it points to a single element. > > > Isaac --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .