Re: [Musicpd-dev-team] [PATCH] Insure proper initialization of stack-allocated struct.
On 2011/02/14 13:11, Christopher Brannon wrote: > > Why not use memset()? That would be more efficient. > > It would. The argument in favor of the static initializer approach is > that it does not assume that NULL == 0. OK, now I understand what you mean, but I personally don't think that language lawyering with no real application to a real platform justifies the additional memory usage and code size. > I can resend a patch using memset, if you like. No, I think it's fine, it's just a very tiny difference, I was just curious why you did it this way. -- The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: Pinpoint memory and threading errors before they happen. Find and fix more than 250 security defects in the development cycle. Locate bottlenecks in serial and parallel code that limit performance. http://p.sf.net/sfu/intel-dev2devfeb ___ Musicpd-dev-team mailing list Musicpd-dev-team@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team
Re: [Musicpd-dev-team] [PATCH] Insure proper initialization of stack-allocated struct.
Max Kellermann writes: >> The struct is now initialized using a static initializer, and this >> technique is compatible with all known versions of libao. > > Why not use memset()? That would be more efficient. It would. The argument in favor of the static initializer approach is that it does not assume that NULL == 0. I can resend a patch using memset, if you like. -- Chris -- The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: Pinpoint memory and threading errors before they happen. Find and fix more than 250 security defects in the development cycle. Locate bottlenecks in serial and parallel code that limit performance. http://p.sf.net/sfu/intel-dev2devfeb ___ Musicpd-dev-team mailing list Musicpd-dev-team@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team
Re: [Musicpd-dev-team] [PATCH] Insure proper initialization of stack-allocated struct.
On 2011/02/13 02:37, Christopher Brannon wrote: > Version 1.0.0 of the libao library added a new field to the > ao_sample_format struct. It is a char * named matrix. When > an ao_sample_format is allocated on the stack, this field contains > garbage. The proper course is to insure that is initialized to NULL. > NULL indicates that we do not want any mapping. > The struct is now initialized using a static initializer, and this > technique is compatible with all known versions of libao. Why not use memset()? That would be more efficient. -- The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: Pinpoint memory and threading errors before they happen. Find and fix more than 250 security defects in the development cycle. Locate bottlenecks in serial and parallel code that limit performance. http://p.sf.net/sfu/intel-dev2devfeb ___ Musicpd-dev-team mailing list Musicpd-dev-team@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team