On Fri, 2007-09-07 at 11:10 +0200, Gianni Costanzi wrote:
> > > But this is just my opinion... furthermore, I almost always use
> > > sizeof(struct my_struct) if src is a pointer to a "struct my_struct"
> > > data structure.
> >
> > And if someone changes the definition of the variable to "struct
> > other_struct"?
> > Of course one *should* check everything on such changes but we all are
> > human too.
> > But I believe more in the compiler and other tools to check BTW.
> 
> Its more a matter of personal opinions I think.. .there is a long

Also, yes (which make such discussions somewhat tedious).

> discussion about this thing on [1], if someone is interested... I
> mainly do it for a matter of readability..
> 
> [1] http://kerneltrap.org/node/5687

Yes, but not even there (Linux kernel) was a concensus IIRC.

IMHO, one needs something like (for user-space) to enforce type-safety:
-----  snip  ----
#define malloc_struct(tag)  (struct tag *)malloc(sizeof(struct tag))
-----  snip  ----
and similar for calloc() etc. and for "union".

And yes, that purposely doesn't support/allow "typedef".

> Sorry for my "intrusion" in the discussion :)

Hey, I'm always open for proposals;-)

	Bernd
-- 
Firmix Software GmbH                   http://www.firmix.at/
mobil: +43 664 4416156                 fax: +43 1 7890849-55
          Embedded Linux Development and Services




