473,767 Members | 2,284 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

compilation wrning in altix350:(Typec asting 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_inde x-1) *
F90_MAX_FLD_SIZ E_IN_BYT
ES + 1 ));

fld->base is of type (void *)
((fld->f90_table_inde x-1) * F90_MAX_FLD_SIZ E_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 1546
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_inde x-1) *
F90_MAX_FLD_SIZ E_IN_BYT
ES + 1 ));

fld->base is of type (void *)
((fld->f90_table_inde x-1) * F90_MAX_FLD_SIZ E_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
25538
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 what's wrong regards I get this error:
23
383
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 i am getting compilation problem, here is the content of s1.c #include <stdio.h> #include <s1.h> void hi();
12
2502
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 main()
2
2586
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 want in there, I will not receive a compilation error). I do get such an error in F() - because of the garbage I intentionally put there - but F() should not compile in the first place. Am I misusing this attribute?! #undef DBG
5
2226
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, compiled assembly for the compiler to load during compilation class MyMethodCompiler : Attribute { // This is called during compilation public override void GenerateMethod(MethodBuilder method)
1
1224
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 eliminated? d:\vasant\mysys\encoder\events.cpp(40) : error C2511: 'Register' : overloaded member function 'void (enum EventType,void (__cdecl *)(enum EventType,void *,void *),void *)' not found in 'EventManager'...
2
13450
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: ../configure --with-as=/usr/ccs/bin/as --with-ld=/usr/ccs/bin/ld --disable-nls
1
2812
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 incorporate the same logic within my simulation, the class that implements the functor logic has problems compiling. I get the following errors: -- Building myTest.cpp --
4
1932
by: jayapal | last post by:
#include <stdio.h> main () { int k = 10; printf ( "%f\n", k); }
0
9571
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9404
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10009
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9959
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9838
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5423
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3929
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2806
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.