473,772 Members | 2,411 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 1549
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
25549
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
2504
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
9621
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
9454
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
10264
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10106
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...
0
9914
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
8937
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7461
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
2
3610
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2851
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.