[Ilugc] Structure alignment & Internal Paddin

  • From: binand@xxxxxxxxx (Binand Sethumadhavan)
  • Date: Mon Aug 14 03:25:06 2006

On 13/08/06, amit saha <dandolls@xxxxxxxxxxx> wrote:

I am still in the dark about this "anonymous structure".

A normal struct would look like:

struct foo {
   int something;
   char something_else;
};

And then you can have:

struct foo hello, world;
struct foo *fooptr = hello;

And so on, wherever you want.

An anomymous structure is one that omits the name for the structure;
here foo. It is useful only for one declaration:

struct {
   int something;
   char somethingelse;
} hello, world;

If you at a later time need another of these structs, you need to
define the struct all over again (for example, the fooptr above). It
is a valid C structure, but its usefulness is dubious. It is so much
easier to follow the first version so as to maintain the structure
definition in one place.

The question is still though unanswered.

What is the question about the original struct?

Binand

Other related posts: