Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

Compiler warnings!

erling_andersen
New Contributor I
482 Views

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-aptrb);

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);

0 Kudos
6 Replies
Ulrich_W_
Beginner
482 Views

Hi!

What is the original type of "schurfiri"?

And which warning level are you using?

0 Kudos
erling_andersen
New Contributor I
482 Views

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?

 

 

 

0 Kudos
Judith_W_Intel
Employee
482 Views

 

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

 

0 Kudos
erling_andersen
New Contributor I
482 Views

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.

 

 

 

 

 

 

 

 

 

   

 

 

0 Kudos
QIAOMIN_Q_
New Contributor I
482 Views

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

0 Kudos
erling_andersen
New Contributor I
482 Views

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. 

 

 

0 Kudos
Reply