Re: [PATCH] bitops cleanup 2/4

Andreas Schwab (schwab@suse.de)
Wed, 03 Apr 2002 14:48:08 +0200


Rusty Russell <rusty@rustcorp.com.au> writes:

|> Linus, please apply (no object code changes).
|>
|> The following are arrays:
|> boot_cpu_data.x86_capability
|> dev->bus->devmap.devicemap
|> tty->process_char_map
|>
|> They don't need the & in front of them: "&array" is defined to be the
|> same as "array" (only reference I can find is the ANSI C "changes
|> since K&R" section).

Wrong.

|> For some reason, gcc (at least 2.95) gives a warning on these when
|> passed as unsigned long *. I think this is a gcc bug...

gcc is correct. "&array" and "array" are different. While they represent
the same address, the types are not compatible. Eg. for "int array[5]"
the type of "array" is "int [5]" (decaying to "int *" in most contexts),
but the type of "&array" is "int (*)[5]" (pointer to array of 5 ints).
And "(&array)[1]" is quite different from "(array)[1]".

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE GmbH, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/