[ros-dev] [ros-diffs] [cgutman] 44286: - Initialize SocketError to 0 to prevent a bogus error from GCC
Alex Ionescu
ionucu at videotron.ca
Wed Nov 25 22:46:44 CET 2009
No they are correct, most of the times the "may" means "given certain code paths", not "may" as in "uhhh... I think it could happen?"
The reason the error often happens, with GCC *AND* MSVC (see previous e-mail) is stuff like this:
BOOLEAN HaveYourDad;
PVOID Pen15;
ULONG YourMom;
if (YourMom)
{
Pen15 = ExAllocateYourDad();
HaveYourDad = TRUE;
}
....
if (HaveYourDad) ExReleaseYourDad(Pen15);
In this case, the compiler might say that your Pen15 may be used without having been initialized because it doesn't realize that I'm only going to have your dad if I also already had your mom.
Had you written:
if (YourMom) ExReleaseYourDad(Pen15); the compiler would probably be smart enough to realize the side-effect.
On 2009-11-25, at 3:31 PM, Timo Kreuzer wrote:
>
> Warning in cases in which the compiler doesn't know whether something is
> correct or not, is stupid in any case IMO, unless it's some
> --enable-uber-pedantic-warnings compiler flag. It could as well say
> "warning: your code could be wrong" and by chance this might be true.
>
> Dmitry Gorbachev wrote:
>> Notice that the warning is "may be used uninitialized" and not "is
>> used uninitialized", so it is correct, in a sense.
>>
>> _______________________________________________
>> Ros-dev mailing list
>> Ros-dev at reactos.org
>> http://www.reactos.org/mailman/listinfo/ros-dev
>>
>>
>
>
> _______________________________________________
> Ros-dev mailing list
> Ros-dev at reactos.org
> http://www.reactos.org/mailman/listinfo/ros-dev
Best regards,
Alex Ionescu
More information about the Ros-dev
mailing list