C++ question; strange warning

From: <Noboom2_at_aol.com>
Date: Wed, 07 Nov 2001 23:01:56 -0500 (EST)

A little C++ question here. Hopefully, there are a few programmers still out
there
using it. :)

I'm getting the following warning when I compile this program. Can anyone
explain
why? More importantly, how can I eliminate the warning (besides disabling it
on the
compile command line)?

Thanks in advance for any assistance.

------------------------------------------------------------------------------

------------------------

% cat d.C
#include <iostream>
#include <stdlib.h>

struct t {
        int turn;
};

void clearit( t b ) {
        b.turn = 0;
}

int main() {
        t game;
        clear( game );
        return EXIT_SUCCESS;
}
% cxx -V
Compaq C++ V6.3-014 for Digital UNIX V4.0D (Rev. 878)
Compiler Driver V6.3-014 (cxx) cxx Driver
% cxx d.C
cxx: Warning: d.C, line 22: variable "game.turn" is fetched, not initialized
        clearit( game );
--------^
%
Received on Thu Nov 08 2001 - 04:03:15 NZDT

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:42 NZDT