This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
On Wed, Jul 09, 2014 at 12:39:45PM -0700, Roland McGrath wrote:
> Nowadays, we probably want to use a balancing test of the performance vs
> the ease-of-maintenance improvement of eliminating warnings. It seems
> almost certain that we don't care about the cost of the dead store in
> xdr_string. But IMHO it should always be an explicit decision to trade off
> after careful consideration of the particular case. It should never be a
> default-OK to pessimize the code to work around the compiler's lack of
> intelligence. Certainly any change made for that reason should have
> comments saying that the initialization is not actually desirable but was
> added to silence a compiler warning.
OK, I'll keep this in mind. I've also added a comment like you
suggested.
Thanks,
Siddhesh
commit d69b7f5ac02989ce3d8577eed86da3e0c8af6c1c
Author: Siddhesh Poyarekar <siddhesh@redhat.com>
Date: Thu Jul 10 10:32:29 2014 +0530
Add comment about SIZE initialization in xdr.c
diff --git a/ChangeLog b/ChangeLog
index dfd393b..a8aa74b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2014-07-10 Siddhesh Poyarekar <siddhesh@redhat.com>
+
+ * sunrpc/xdr.c (xdr_string): Add comment about SIZE
+ initialization.
+
2014-07-09 David S. Miller <davem@davemloft.net>
* sysdeps/sparc/fpu/libm-test-ulps: Update.
diff --git a/sunrpc/xdr.c b/sunrpc/xdr.c
index 129abd8..fade667 100644
--- a/sunrpc/xdr.c
+++ b/sunrpc/xdr.c
@@ -739,6 +739,8 @@ xdr_string (xdrs, cpp, maxsize)
u_int maxsize;
{
char *sp = *cpp; /* sp is the actual string pointer */
+ /* Initialize to silence the compiler. It is not really needed because SIZE
+ never actually gets used without being initialized. */
u_int size = 0;
u_int nodesize;
Attachment:
pgpBoou0ydvUG.pgp
Description: PGP signature
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |