cvs commit: src/sys/amd64/include md_var.h

Dag-Erling Smørgrav des at des.no
Thu Jan 18 09:08:34 UTC 2007


Craig Rodrigues <rodrigc at FreeBSD.org> writes:
>   Modified files:
>     sys/amd64/include    md_var.h 
>   Log:
>   Revert previous change.
>   
>   Requested by:   kan

You shouldn't have reverted this because kan requested it, you should
have reverted it because it was simply wrong and broke the build.  An
array is not the same as a pointer; it only seems that way because the
syntax for dereferencing both is the same.  There is a fundamental
difference: if foo is an array, then &foo is the address at which the
contents of the array are stored.  If foo is a pointer, then &foo is
the address at which the *address* of the array is stored.

As regards the "test case" you quoted at kan, your "fix" only appears
to work because you have no correct definition or declaration of
array_foo in scope.  If your sample code actually did something with
the arrays / pointers it declares and you tried to run it, you'd get a
segfault.

DES
-- 
Dag-Erling Smørgrav - des at des.no


More information about the cvs-src mailing list