This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]