On Tue, 2009-06-02 at 18:11 +0200, Jim Meyering wrote: > Ryan O'Hara wrote: > > This patch is correct, but what I intended was to use sizeof (struct > > resource_instance). Can we do that instead? > > Please try to move to "sizeof (VARIABLE)".
I really don't prefer this because people __often__ make the error of not dereferencing a pointer type. This happens more often then a structure completely changes on the variable the sizeof should operate on. These sorts of errors are extremely difficult to notice as well. Regards -steve > That has the advantage that if VARIABLE's type is ever > changed, you don't have to go around and find all "sizeof(OLD_TYPE)" > and change them to "sizeof(NEW_TYPE)". It's far to easy to forget > or to miss one, and the result is often memory corruption. > > That is much more maintainable. > > One nice side effect is that "VARIABLE" is often more concise > than "STRUCT TYPE_NAME". > > > On Tue, Jun 02, 2009 at 05:34:04PM +0200, Jan Friesse wrote: > >> --- > >> trunk/services/lck.c | 4 ++-- > >> 1 files changed, 2 insertions(+), 2 deletions(-) > >> > >> diff --git a/trunk/services/lck.c b/trunk/services/lck.c > >> index 099835c..383e862 100644 > >> --- a/trunk/services/lck.c > >> +++ b/trunk/services/lck.c > >> @@ -2042,7 +2042,7 @@ error_exit: > >> * Create resource instance. > >> */ > >> hdb_handle_create (&resource_hdb, > >> - sizeof (resource_instance), &resource_id); > >> + sizeof (*resource_instance), &resource_id); > _______________________________________________ > Openais mailing list > [email protected] > https://lists.linux-foundation.org/mailman/listinfo/openais _______________________________________________ Openais mailing list [email protected] https://lists.linux-foundation.org/mailman/listinfo/openais
