The importance of showing ALL of the code in C

From: John Chris Wren <jcwren_at_jcwren.com>
Date: Wed Feb 6 13:20:24 2002

        Or it would possibly cause a segfault, since A can only be legally indexed
by 0..9. (This is assuming it didn't get optimized out).

        Sometimes, you need to specify the address or pointers to addresses of
hardware registers as 'volatile', so that the compiler does not optimize
them out of doing what you expect.

        And yes, seeing all the code is important. Otherwise, it's just pure
speculation.

        --John


> -----Original Message-----
> From: owner-classiccmp_at_classiccmp.org
> [mailto:owner-classiccmp_at_classiccmp.org]On Behalf Of Fred Cisin
> (XenoSoft)
> Sent: Wednesday, February 06, 2002 13:21 PM
> To: classiccmp_at_classiccmp.org
> Subject: The importance of showing ALL of the code in C
>
>
> an example:
>
> int A[10];
> int N;
> N = 3;
> A[10] = 2;
> printf("%d",N);
>
> In many other languages, A[10] = 2 would not have any effect on N.
>
>
Received on Wed Feb 06 2002 - 13:20:24 GMT

This archive was generated by hypermail 2.3.0 : Fri Oct 10 2014 - 23:34:44 BST