473,402 Members | 2,053 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

compilation wrning in altix350:(Typecasting from int to void *)

Hi,

While typecasting an integer to (void *) the following warning
is found.

warning: cast to pointer from integer of different size.

This is the line where typecasting is done.
fld->base = (void *)(((fld->f90_table_index-1) *
F90_MAX_FLD_SIZE_IN_BYT
ES + 1 ));

fld->base is of type (void *)
((fld->f90_table_index-1) * F90_MAX_FLD_SIZE_IN_BYTES + 1 ) is an
integer.

This is a c++ code, compiled using c++ compiler in altix350.
Waiting for immediate help to resolve the warning.

Thanks in advance,
Rama Kanta Sinha.

Apr 1 '06 #1
1 1519
ra*************@gmail.com wrote:
Hi,

While typecasting an integer to (void *) the following warning
is found.
Why do you cast an integer to a pointer?
warning: cast to pointer from integer of different size.

This is the line where typecasting is done.
fld->base = (void *)(((fld->f90_table_index-1) *
F90_MAX_FLD_SIZE_IN_BYT
ES + 1 ));

fld->base is of type (void *)
((fld->f90_table_index-1) * F90_MAX_FLD_SIZE_IN_BYTES + 1 ) is an
integer.

This is a c++ code, compiled using c++ compiler in altix350.
Waiting for immediate help to resolve the warning.


Well, don't cast an integer to a pointer or use an integer type that has the
same size as a pointer on your architecture. Your compiler's manual should
tell you the sizes.

Apr 1 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Ced | last post by:
Hi, i'm not an expert in C but i try to compile BTNG software under linux kernel 2.4.2-2. I get these errors at the very first stage. Does someone could have a rapid look on this and tell me...
23
by: foodic | last post by:
Hi all I have a little bit of programming experience on windows 98 using C. But this is my first attempt to compile a program on Linux using gcc.I have two files s1.c and s1.h and while compiling...
12
by: wanghz | last post by:
Hi, Could I ask some questions about the conditional compilaion? Suppose I have three simple files: a.c, b.c and c.h /* --------a.c--------- */ #include <stdio.h> #include "c.h" int...
2
by: FireStarter | last post by:
Guys, in the code that follows, why does the method F() still compile, even if DBG is undefined? Inside method G(), the code inside <#if DBG> does not compile (notice that I can write whatever I...
5
by: Stuart Carnie | last post by:
I suspect it's unlikely, but you'll never know until you ask, but are there any attributes that would allow us to contribute to the compiled output? e.g. // this class exists in a separate,...
1
by: vasant63 | last post by:
Hi, This is the compilation errors which I am getting when I compiling the code with VC++ 6.0. The same code is getting compiled in Linux OS. I would like to know how this compiler error can be...
2
by: tkirankumar | last post by:
Hi all, uname -a SunOS cbmrsd1a1 5.10 Generic_118833-17 sun4us sparc FJSV,GPUZC-M g++ -v Reading specs from /usr/local/lib/gcc-lib/sparc-sun-solaris2.10/3.3.2/specs Configured with:...
1
by: BSand0764 | last post by:
I'm getting an error that I can't seem to resolve. When I compile the Functor related logic in a test program, the files compile and execute properly (see Listing #1). However, when I...
4
by: jayapal | last post by:
#include <stdio.h> main () { int k = 10; printf ( "%f\n", k); }
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.