Discussion:
[Clanlib-devel] Patch for warnings
Ben Chambers
2006-12-20 20:30:44 UTC
Permalink
Since warnings bug me, I've patched a number of files to get rid of them.

Mostly, I've included explicit type castes where the casting was done
implicitly.

Also, in collision_outline.cpp, on lines 300, 339, 366, I changed
truncate-by-caste (requires two castes) to floor().

Note that, in collision_outline.cpp, on lines 456, 457, 519, 520, 588,
589: Changing what's included in the parenthesis could affect rounding.

...Chambers



__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Seth A. Robinson
2007-01-31 01:26:25 UTC
Permalink
Hi Ben,

Sorry for the slow reply and thanks for the patch.

Anyway, I applied it, but figured I'd better not commit right away because I
noticed I was still getting compiler warnings for many things that were
changed, for instance:

The old float offx1 = cos(M_PI * 2.0 * (e / numsegments))*radius;

And the new

float offx1(cos(M_PI * 2.0 * (e / numsegments))*radius);

give the same warning under VS8:

.\Display\Collision\collision_outline.cpp(333) : warning C4244:
'initializing' : conversion from 'double' to 'float', possible loss of data

I can fix it by doing this:

float offx1 = (float)cos(M_PI * 2.0 * (e / numsegments))*radius;

so I wanted to ask, what compiler(s) are you using on your side? GCC 4.X? Is
it possible for you to also test under MS VS8? Probably not but hey,
thought I'd ask :)

-Seth


-----Original Message-----
From: Ben Chambers [mailto:***@yahoo.com]
Sent: Thursday, December 21, 2006 5:31 AM
To: ClanLib Devel
Subject: [Clanlib-devel] Patch for warnings

Since warnings bug me, I've patched a number of files to get rid of them.

Mostly, I've included explicit type castes where the casting was done
implicitly.

Also, in collision_outline.cpp, on lines 300, 339, 366, I changed
truncate-by-caste (requires two castes) to floor().

Note that, in collision_outline.cpp, on lines 456, 457, 519, 520, 588,
589: Changing what's included in the parenthesis could affect rounding.

...Chambers



__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Jason Green
2007-01-31 02:30:59 UTC
Permalink
That's a very common warning in MSVC that is often just gotten rid of
in cross-platform code with a #pragma disable.. 4244, maybe? I think
other parts of ClanLib might have that pragma setting?
Post by Seth A. Robinson
Hi Ben,
Sorry for the slow reply and thanks for the patch.
Anyway, I applied it, but figured I'd better not commit right away because I
noticed I was still getting compiler warnings for many things that were
The old float offx1 = cos(M_PI * 2.0 * (e / numsegments))*radius;
And the new
float offx1(cos(M_PI * 2.0 * (e / numsegments))*radius);
'initializing' : conversion from 'double' to 'float', possible loss of data
float offx1 = (float)cos(M_PI * 2.0 * (e / numsegments))*radius;
so I wanted to ask, what compiler(s) are you using on your side? GCC 4.X? Is
it possible for you to also test under MS VS8? Probably not but hey,
thought I'd ask :)
-Seth
-----Original Message-----
Sent: Thursday, December 21, 2006 5:31 AM
To: ClanLib Devel
Subject: [Clanlib-devel] Patch for warnings
Since warnings bug me, I've patched a number of files to get rid of them.
Mostly, I've included explicit type castes where the casting was done
implicitly.
Also, in collision_outline.cpp, on lines 300, 339, 366, I changed
truncate-by-caste (requires two castes) to floor().
Note that, in collision_outline.cpp, on lines 456, 457, 519, 520, 588,
589: Changing what's included in the parenthesis could affect rounding.
...Chambers
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
clanlib-devel mailing list
https://lists.sourceforge.net/lists/listinfo/clanlib-devel
Ben Chambers
2007-01-31 05:01:38 UTC
Permalink
Post by Seth A. Robinson
so I wanted to ask, what compiler(s) are you using on your side? GCC 4.X? Is
it possible for you to also test under MS VS8? Probably not but hey,
thought I'd ask :)
-Seth
Actually, I use VC Express (which I believe is VC 8). I don't remember
if I removed ALL the warnings generated by ClanLib on my machine, but I
know that there weren't any more warnings from the lines I changed.

Next chance I get, I'll recompile the whole thing and check for warnings
again.

...Chambers

Loading...