Compiler warnings!

Compiler warnings!

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[j]-aptrb[j]);

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.


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)


   void myfunc(const integer64 *x);

7 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.


What is the original type of "schurfiri"?

And which warning level are you using?

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?





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.



That are right I have /Wp64 enabled. But I still do not understand why it warns in the case above. Given

integer64 *x;


   (const integer64 *) x

should ***NOT*** give rise to a warning: Giving a warning in this case is counter productive in fact.













Yes, but 'print diagnostics for 64-bit porting' may also be productive for other developers i think.

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. 



Leave a Comment

Please sign in to add a comment. Not a member? Join today