Re: Structure declaration without its members variables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 27 Apr 2015 00:16:59 +0530, harshkdev said:

> struct kvm;
> struct kvm_vcpu;
>
> Generally we declare structure and its member at same place.

It's a forward declaration.

Consider two structures that have pointers to each other:

struct a {
      int b, c, d;
      struct *b b_ptr;
}

struct b {
	int foo, bar, baz;
	struct *a a_ptr;
}

Now, the struct *b in the first structure won't compile because it hasn't
seen b yet.  So we stick a 'struct b;' in front both of them so struct a can
compile successfully.

Attachment: pgpvbMkpzdCf6.pgp
Description: PGP signature

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux