[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: lib/51003: src/lib/libc/time/zic.c:2561]: (error) Uninitialized variable: xr
The following reply was made to PR lib/51003; it has been noted by GNATS.
From: Robert Elz <kre%munnari.OZ.AU@localhost>
Subject: Re: lib/51003: src/lib/libc/time/zic.c:2561]: (error) Uninitialized variable: xr
Date: Thu, 24 Mar 2016 23:50:27 +0700
Date: Thu, 24 Mar 2016 12:35:00 +0000 (UTC)
| So local variable xr is only partially initialised when it
| is given to rpytime.
Everything that will be accessed is initialised, so it is OK.
| Suggest initialise all fields of xr to something sensible, maybe
| with a call to memset, shortly after its declaration.
| memset( &xr, 0, sizeof( xr));
But if it is to be invalid (or inappropriate) to pass a pointer to a
partially uninitialised struct to a function, how can it possibly be
valid to pass a pointer to a wholly uninitialised struct?
It is only because you know what memset does with the pointer that this
is acceptable. Just as it is that we know what rpytime() does with the
pointer makes it OK to be init'd just as it is.
Main Index |
Thread Index |