This is the mail archive of the
insight@sources.redhat.com
mailing list for the Insight project.
Re: Bugs/Features
- To: Keith Seitz <keiths at cygnus dot com>
- Subject: Re: Bugs/Features
- From: Tom Tromey <tromey at redhat dot com>
- Date: 13 Sep 2001 18:07:29 -0600
- Cc: Willem Hajenius <willem dot hajenius at ping dot be>, <insight at sourceware dot cygnus dot com>
- References: <Pine.GSO.4.33.0109131237200.9617-100000@makita.cygnus.com>
- Reply-To: tromey at redhat dot com
Keith> Unfortunately, as you've discovered, the "dismissable" warnings
Keith> are renewed every time Insight is run.
I think there's a PR for this.
>> struct rec
>> {
>> char c[5];
>> };
>>
>> f = (foo*) malloc (10);
Keith> (I must say -- this is an evil coding practice! Why hide the
Keith> true type of the variable? If you want to make it opaque, just
Keith> make it opaque and cast it when needed. Maybe this is just a
Keith> bad example??)
Actually this is the old C `struct hack' idiom. In traditional C you
were allowed to declare the last field in a struct as an array; then
you could allocate additional space and it would act like a
variable-sized array, without the overhead of an additional pointer in
the struct.
It isn't very common, but it isn't uncommon either.
Tom