Discussion:
q_shared.c - possible typo error?
Nick Warne
2005-09-12 19:08:35 UTC
Permalink
I noticed this today - some declares stuck between two functions.

In q_shared.c:


=====================================

float anglemod(float a)
{
#if 0
if (a >= 0)
a -= 360*(int)(a/360);
else
a += 360*( 1 + (int)(-a/360) );
#endif
a = (360.0/65536) * ((int)(a*(65536/360.0)) & 65535);
return a;
}

int i; <-------------------- What are these
vec3_t corners[2]; <-------------------- here for ???


// this is the slow, general version
int BoxOnPlaneSide2 (vec3_t emins, vec3_t emaxs, struct cplane_s *p)
{
int i;
...
...
=====================================



Remove?

Nick
--
"When you're chewing on life's gristle,
Don't grumble, Give a whistle..."
brendanburns
2005-09-14 22:22:44 UTC
Permalink
That indeed does appear to be a typo, it has been removed from CVS...

Thanks!
--brendan
Post by Nick Warne
I noticed this today - some declares stuck between two functions.
=====================================
float anglemod(float a)
{
#if 0
if (a >= 0)
a -= 360*(int)(a/360);
else
a += 360*( 1 + (int)(-a/360) );
#endif
a = (360.0/65536) * ((int)(a*(65536/360.0)) & 65535);
return a;
}
int i; <-------------------- What are these
vec3_t corners[2]; <-------------------- here for ???
// this is the slow, general version
int BoxOnPlaneSide2 (vec3_t emins, vec3_t emaxs, struct cplane_s *p)
{
int i;
...
...
=====================================
Remove?
Nick
--
"When you're chewing on life's gristle,
Don't grumble, Give a whistle..."
Nick Warne
2005-09-15 17:00:40 UTC
Permalink
Post by brendanburns
That indeed does appear to be a typo, it has been removed from CVS...
Thanks!
--brendan
Post by Nick Warne
I noticed this today - some declares stuck between two functions.
It's in _all_ the q_shared.c files ... game/ ctf/ etc. Not just one file.
Looks like the templet had the typo and therefore all q_shared.c has it.

Nick
--
"When you're chewing on life's gristle,
Don't grumble, Give a whistle..."
qudos
2005-09-15 17:24:15 UTC
Permalink
Sometimes in the process build i've read:

warning: 'blah_blah' might be used uninitialized in this function

Moving out the declaration from the function just remove the warning,
don't know if this is the reason for this declarations.
Post by Nick Warne
Post by brendanburns
That indeed does appear to be a typo, it has been removed from CVS...
Thanks!
--brendan
Post by Nick Warne
I noticed this today - some declares stuck between two functions.
It's in _all_ the q_shared.c files ... game/ ctf/ etc. Not just one file.
Looks like the templet had the typo and therefore all q_shared.c has it.
Nick
--
"When you're chewing on life's gristle,
Don't grumble, Give a whistle..."
Nick Warne
2005-09-15 17:44:40 UTC
Permalink
Post by qudos
warning: 'blah_blah' might be used uninitialized in this function
All that means is a varible maybe referenced later (i.e. a crash situation).

Take this code:

int i;
int x;

if (i == 5)
x = 1;

Here, if i != 5 then x will never be given a value, and could be anything.
Post by qudos
Moving out the declaration from the function just remove the warning,
don't know if this is the reason for this declarations.
I can't see how that is the case here. What compiler you use?

Nick
--
"When you're chewing on life's gristle,
Don't grumble, Give a whistle..."
qudos
2005-09-15 18:12:30 UTC
Permalink
Post by Nick Warne
I can't see how that is the case here. What compiler you use?
Nick
--
"When you're chewing on life's gristle,
Don't grumble, Give a whistle..."
GCC , version? mainly 3.x

The last i was working was Tremor, just get the files
http://qudos.quakedev.com/linux/quake1/Tremor_3.2.4-bin-src.linux.tar.bz2
and compile it, there are some 'uninitialized' warnings, if you move
out of function the declarations the warnings will dissapear.

Or just do it with quake2 icculus, dont know now if in q2icculus the
-Wall exist in the base CFLAGS

Maybe i'm wrong :/

Loading...