[NTLUG:Discuss] OT C question

Spicerun spicerun at verizon.net
Sat Feb 18 11:58:55 CST 2006


Well, I'd love to know when that was added to the Ansi C standard 
then.... True, I haven't read the latest standard in detail, but this 
certainly wasn't the case in the past.  In a lot of systems I've worked 
on, adding absolute integers to pointers have caused a lot of bugs in 
the programs for the reasons I mentioned previously, and I'm talking 
about a few current embedded compilers as well.  I also know a lot of 
Linux/Unix and MS applications have crashed many times due to adding 
Integers to pointer bugs.

Even if it is guaranteed to be right, what's the harm to simply add the 
=+ increment instead of the + addition to a pointer for readability sake?

Otherwise, we can agree to disagree.

--Spicerun

Eric Schnoebelen wrote:
> 	Pointer math is guarenteed to adjust the pointer in
> sizeof(type) increments, just as pointer increment and pointer
> decrement would.  As long as you have the pointer types defined
> correctly, pointer math of all forms will work.
>
> --
> Eric Schnoebelen		eric at cirr.com		http://www.cirr.com
>     "A computer lets you make more mistakes faster than any invention in
>     human history - with the possible exceptions of handguns and tequila."
> 					    - Mitch Ratliffe
>
> _______________________________________________
> https://ntlug.org/mailman/listinfo/discuss
>
>   





More information about the Discuss mailing list