cast from const void* to unsigned int loses precision


 
Thread Tools Search this Thread
Operating Systems Linux Red Hat cast from const void* to unsigned int loses precision
# 1  
Old 08-08-2008
cast from const void* to unsigned int loses precision

Hello everey one,

here i am attempting to compile a c++ project .it's throughing the following errors.

my machine details are as follows:

Code:
Linux chmclozr0119 2.6.18-53.el5 #1 SMP Wed Oct 10 16:34:19 EDT 2007 x86_64 x86_64 x86_64 GNU/Linux

errors:
=====
Generating /root/cc/unix-ce/root/subsys/cb/cdbg/obj_sched_csvON/Linux//cdbg_CDBSP_cdbRS.o from cdbg_CDBSP_cdbRS.C
        /usr/bin/c++ -c -g -DDEBUG -DMAT  -I/root/cc/unix-ce/mvfs/3pp/rogueTools.h/v7.0.3/               -I/root/cc/unix-ce/root/subsys/cb/cdbg/src -I/root/cc/unix-ce/root/subsys/cb/cdbg/obj_sched_csvON/Linux/ -I/root/cc/unix-ce/root/subsys/lib/Linux -I/root/cc/unix-ce/root/subsys/cb/cdbg/include -I/root/cc/unix-ce/root/subsys/include -I/opt/dce/include -I/opt/dce/include/dce -DUSE_FREE_DCE  -I/root/cc/unix-ce/root/3pp/include/Linux -I/usr/include/X11 -I/usr/X11R6/include    -D_GNU_SOURCE   -DLINUX -DUSE_SHADOW -DUCE_SSH -DIDL_CHAR_IS_CHAR -D_REENTRANT -fsigned-char -DCXX_VERSION=4.1.2 -DRW_MULTI_THREAD -DSNACC_DEEP_COPY  -DSWP_CDBG_sched_csvON  -o /root/cc/unix-ce/root/subsys/cb/cdbg/obj_sched_csvON/Linux//cdbg_CDBSP_cdbRS.o cdbg_CDBSP_cdbRS.C
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/backward/iostream.h:31,
                 from cdbg_CDBSP_cdbRS.C:30:
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.
ERROR 1) /root/cc/unix-ce/mvfs/3pp/rogueTools.h/v7.0.3/rw/defs.h:542: error: using typedef-name âstd::istreamâ after âclassâ
ERROR 2)/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iosfwd:137: error: âstd::istreamâ has a previous declaration here
ERROR 3)/root/cc/unix-ce/mvfs/3pp/rogueTools.h/v7.0.3/rw/defs.h:543: error: using typedef-name âstd::ostreamâ after âclassâ
ERROR4)/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iosfwd:138: error: âstd::ostreamâ has a previous declaration here
ERROR5)/root/cc/unix-ce/mvfs/3pp/rogueTools.h/v7.0.3/rw/defs.h:544: error: using typedef-name âstd::iosâ after âclassâ
ERROR 6)/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iosfwd:135: error: âstd::iosâ has a previous declaration here
/root/cc/unix-ce/mvfs/3pp/rogueTools.h/v7.0.3/rw/tooldefs.h: In function âunsigned int RWhashAddress(const void*)â:
ERROR7)/root/cc/unix-ce/mvfs/3pp/rogueTools.h/v7.0.3/rw/tooldefs.h:424: error: cast from âconst void*â to âunsigned intâ loses precision
ERROR8)/root/cc/unix-ce/mvfs/3pp/rogueTools.h/v7.0.3/rw/tooldefs.h:424: error: cast from âconst void*â to âunsigned intâ loses precision
cdbg_CDBSP_cdbRS.C: In function âvoid cdbg_f1_init_scheduler(int, char**, unsigned32*)â:
ERROR9)cdbg_CDBSP_cdbRS.C:61: error: invalid conversion from âintâ to âstd::_Ios_Openmodeâ
ERROR10)cdbg_CDBSP_cdbRS.C:61: error:   initializing argument 3 of âstd::strstream::strstream(char*, int, std::_Ios_Openmode)â
*** Error code 1
clearmake: Error: Build script failed for "/root/cc/unix-ce/root/subsys/cb/cdbg/obj_sched_csvON/Linux//cdbg_CDBSP_cdbRS.o"
========================================================

clearmake[1]: Leaving directory `/root/cc/unix-ce/root/subsys/cb/cdbg/src'
*** Error code 1
clearmake: Error: Build script failed for "compile"


error 1 has the following code:

class _RWCLASSTYPE istream;

error 2 has the follwing code :
typedef basic_istream<char>           istream;        ///< @isiosfwd

error 3 has the following code
class _RWCLASSTYPE ostream;

error 4 has the following code:
typedef basic_ostream<char>           ostream;        ///< @isiosfwd
error 5 has the following code:
class _RWCLASSTYPE ios;
error 6 has the following code:
typedef basic_ios<char>               ios;            ///< @isiosfwd

error 7&8 has the following code:

inline unsigned RWhashAddress(const void* a)
{
  // For other addresses, mix in some higher order bits
  // into the lower order bits:
  return ((unsigned)a ^ ((unsigned)a>>3));
}
error 9 has the following code:
strstream tmpStrStream((char *) iString.data(),leni,(int)ios::ate);

error 10 has the following code:

unsigned long i = 0;
  RWCString iString(i2_argv[1]);
  size_t len = iString.length();
  int leni = (int) len;
  strstream tmpStrStream((char *) iString.data(),leni,(int)ios::ate);
  tmpStrStream >> i;
  g_cdb_key = i;


CAN SOMEBODY HELP ME TO SOLVE THESE ERRORS.

kind regards,
Srinivas.Mannam
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. OS X (Apple)

Unsigned to signed, error?...

Hi guys... Macbook Pro, 13", circa August 2012, OSX 10.7.5, default bash terminal. I require the capability to convert +32767 to -32768 into signed hex words... The example piece code below works perfectly except... #/bin/bash # sign.sh # Unsign to sign... while true do # I have used... (2 Replies)
Discussion started by: wisecracker
2 Replies

2. Programming

Help with understanding ( int, char, long, short, signed, unsigned etc.... )

My question is simple: When should I use a long, int, char, unsigned/signed variables?? When I declare a variable "unsigned;" what did I do it??? Why would I delcare an integer "long" or "short" ( unsigned or signed)?? Any examples of when things like "unsigned", "long", "short" etc...... (6 Replies)
Discussion started by: cpp_beginner
6 Replies

3. Programming

C++ program is crashing on re-assigning const static member variable using an int pointer

Hi, Can any one tell me why my following program is crashing? #include <iostream> using namespace std; class CA { public: const static int i; }; const int CA::i = 10; int main() { int* pi = const_cast<int*>(&CA::i); *pi = 9; cout << CA::i << endl; } (6 Replies)
Discussion started by: royalibrahim
6 Replies

4. Programming

Handle int listen(int sockfd, int backlog) in TCP

Hi, from the manual listen(2): listen for connections on socket - Linux man page It has a parameter called backlog and it limits the maximum length of queue of pending list. If I set backlog to 128, is it means no more than 128 packets can be handled by server? If I have three... (3 Replies)
Discussion started by: sehang
3 Replies

5. UNIX for Dummies Questions & Answers

int open(const char *pathname, int flags, mode_t mode) doubt...

hello everybody! I want to create a file with permissions for read, write, and execute to everybody using C, so I write this code: #include <stdio.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> int main(){ int fileDescriptor; fileDescriptor =... (2 Replies)
Discussion started by: csnmgeek
2 Replies

6. Programming

Help - Cast converts default int return type

What does the warning message 724 "Cast converts default int return type to." tell me. I am new to C. (used it some in college). We are migrating our c-code to 10.2.0.3.0. The programs compiled clean. However there were several warning messages that kick out. The most prominent warning is: ... (5 Replies)
Discussion started by: rtgreen
5 Replies

7. Programming

to get the correct value with unsigned int

hi, Please help me with the following code to get the difference in values. struct a{ int b1; int c1; char d1; } main() { unsigned int b=10; unsigned int c; c = b - (unsigned int )sizeof(a); printf("%d",c); } Here c returns some junk value. How can i get the... (2 Replies)
Discussion started by: naan
2 Replies

8. Programming

difference between int ** func() and int *& func()

What is the difference between int** func() and int*& func(). Can you please explain it with suitable example. Thanks, Devesh. (1 Reply)
Discussion started by: devesh
1 Replies

9. Programming

why to use dynamic cast in c++

class base { public: virtual void disp() {cout<<"from base\n";} }; class derv : public base { public: void disp() {cout<<"from der\n";} }; int main() { base *b=new derv; b->disp(); derv *d; d=dynamic_cast<derv*>(b); d->disp(); return(0); (0 Replies)
Discussion started by: sarwan
0 Replies

10. Programming

Unsigned int

How can I store and/or print() a number that is larger than 4 294 967 295 in C? is int64_t or u_int64_t what I need ? if, so how can I printf it to stdout? (2 Replies)
Discussion started by: nimnod
2 Replies
Login or Register to Ask a Question