Advertisement

Help needed regarding the Quake2 engine & VC++

Started by April 08, 2000 06:53 AM
1 comment, last by Ahnab 24 years, 8 months ago
Hi! I downloaded the Q2 cource files from id''s site, and to test em, I made a new gamex86.dll by compiling all the files. The prob I''ve got is that I get a warning (NOT an error) that sez the following:- D:\Games\Quake2\Source\game\p_weapon.c(976) : warning C4700: local variable ''start'' used without having been initialized I''m using VC++ 6.0 Professional Edition. In all honesty, I have no idea why in Hell I''m geting this warning in the first place. All/any help would sure be appreciated. Thanx!
You usually get that error when a variable is used in some way, without first being given a value.

Check this example code:

void myfunc()
{
int i;
my_other_func(i);
}

Thats a fairly lame and contrived example, but the point is you are using the variable when you don''t actually know what is stored in it. Remember, a variable, when first declared, is simply a named region of memory - it doesn''t necesarily mean that memory contains zero.
That example re-written to initialise the value of i would be something like this.

void myfunc()
{
int i;
i = 0; // here we initialise i
my_other_func(i);
}

I hope that clears things up, if I''m wrong I''m sure someone will correct me.

Take it easy,

-Mezz

Advertisement
Weird that the compiler would give you a warning, when I compile the Q2 source it doesn''t give me any warnings at all.

/. Muzzafarath
I'm reminded of the day my daughter came in, looked over my shoulder at some Perl 4 code, and said, "What is that, swearing?" - Larry Wall

This topic is closed to new replies.

Advertisement