- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Why does the compiler generate a warning when I do explicit type cast as in the following:
src\homo\ipfac.c(15511): warning #2259: non-pointer conversion from "__int64" to "integer32={integer={int}}" may lose significant bits
nzj = (integer32) (aptre
I mean if I did not do a explicit type cast then the warning is in place. When I do the type cast then it means I know what I am doing.
Also
src\homo\ipfac.c(9666): warning #2312: pointer cast involving 64-bit pointed-to type
(const integer64 *) schurfiri,
Why do I get this warning. I do
myfunc((const integer64 *) schurfiri)
where
void myfunc(const integer64 *x);
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi!
What is the original type of "schurfiri"?
And which warning level are you using?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It is originally
integer64 *
I think I use default warning levels. Well, I turn some warnings off. For instance I think
integer32 x;
integer64 y=1,z=2;
x = (integer32) (z-y);
seems to generate warnings. I know in my code z-y is always a 32 bit integer and there I do a explicit type cast telling the computer this ok.
My whole point is why does the compiler generate warnings when I do explicit type casts. Is there anyway I can turn such warnings off?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
These warnings are only emitted if you have enabled 64 bit pointer warnings (command line option /Wp64):
/Wp64 print diagnostics for 64-bit porting
I don't think this switch is enabled by default.
Judy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That are right I have /Wp64 enabled. But I still do not understand why it warns in the case above. Given
integer64 *x;
then
(const integer64 *) x
should ***NOT*** give rise to a warning: Giving a warning in this case is counter productive in fact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, but 'print diagnostics for 64-bit porting' may also be productive for other developers i think.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In fact I use the clang compiler occasionally because it generates way more meaning warnings.
The purpose of this post was to illustrate a couple of places where I think the warnings Intel C are somewhat meaningless and counter productive. I can see now I did not have success.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page