This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Implicit conversion from structure to its pointer?
- From: 황명규 <mghwang at innoace dot com>
- To: <gcc-help at gcc dot gnu dot org>
- Date: Wed, 1 Oct 2003 14:22:20 +0900
- Subject: Implicit conversion from structure to its pointer?
Dear GCC gurus
I'm using gcc version 3.0.1 on HPUX.
On my system, the following code works perfectly.
The actual prototype of bzero() is 'void bzero(void *, size_t n)'.
-----------------------------------------------
struct a{
int field[20];
}
...
struct a b;
bzero(b, sizeof(b)); /* works like 'bzero(&b, sizeof(b))' */
...
-----------------------------------------------
I couldn't find such promotion/conversion rule in the book.
(structure name -> pointer to structure)
GCC version 2.9.x generates type mismatch error.
Can anybody explain why gcc 3.x automatically passes the address of a struct
instead of passing the whole content of the struct ?
On what specification is this behavior based? C99 or just a gcc extension?
Thanks in advance.
--
Myung-gyu Hwang
mghwang@innoace.com