Re: casting on 64/32-bit environment

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 
> You're casting from a pointer to an integer.  This is the wrong thing
> to do.
> 

>  > Down I give a part of a code:
>  > 
>  > //FUNC.CC
>  > void func ()
>  > {
>  >    ?
>  >    int iel=0;
>  >    ?
>  >    PtrF <EL> el01 = (EL*) iel; 	//line 105
> 
> Don't do this.  The answer to your problem is to not cast a pointer to
> an integer.  If you can explain why you want to do such casting, we'll
> be able to tell you how to avoid it.
> 
I did not write the program. Structure, which I gave last time, is such that 
enables communication between Fortran and C++ on a way that has historical 
reasons. So the structure is a fact, which can't be changed.
There are no problems if the program is compiled on 32-bit environment, but on 
64-bit environment I get casting warnings.
The purpose of casting is to initialise arrays used by C++ and Fortran. For 
test I have made a small program with that structure. I found out (based also 
on info from this forum) that if I use long instead of int, I do not have 
warnings any more. This seems to be a solution, which I have not implemented 
yet.

Mitja


____________________
http://www.email.si/



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux