[OT] C pointers: BSD versus Linux?

Matthew Dillon dillon at apollo.backplane.com
Thu Jun 1 10:44:28 PDT 2006


:What I see in linux is that the two values are miles apart,
:but in *BSD they differ by only a few bytes.  I *assume* this
:means that in *BSD, t is pointing to a valid memory location
:very close to d, whereas in linux t is pointing to some
:random number.  Does this seem a reasonable idea?
:
:Thanks again for everyone's help.

    Yes.  Because the variables are not initialized, the contents of
    the stack representing the variables is whatever happened to be on
    the stack.

    If you are doing any serious programming I recommend always using:

    -Wall -Wstrict-prototypes

    Which will catch most common programming errors, such as using 
    uninitialized variables.

					-Matt
					Matthew Dillon 
					<dillon at xxxxxxxxxxxxx>





More information about the Users mailing list