473,320 Members | 2,193 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,320 software developers and data experts.

32 bit pointer to 64 bit pointer

Hi,
I am porting a 32-bit application to 64-bit application (AMD).
I am getting the error:

XXX.cpp(49) : warning C4267: '=' : conversion from 'size_t' to 'long',
possible loss of data
XXX.cpp(84) : error C2664: 'HRESULT BinValue::get(const unsigned char
*&,long &)' : cannot convert parameter 1 from 'unsigned char *' to
'const unsigned char *&'
Conversion loses qualifiers
NMAKE : fatal error U1077: 'cl' : return code '0x2'

In 64 bit AMD programming the data type unsigned INT_PTR (unsigned
int*) is UINT_PTR and for unsigned LONG_PTR (unsigned long*) is
ULONG_PTR. What should be the data type for unsigned char* ????
Respects,
Saurabh Aggrawal
Sr. S/w Programmer

Jul 22 '05 #1
1 3802

Saurabh Aggrawal wrote:
Hi,
I am porting a 32-bit application to 64-bit application (AMD).
I am getting the error:

XXX.cpp(49) : warning C4267: '=' : conversion from 'size_t' to 'long', possible loss of data
That is of course your 32/64 bits problem. A number representing4Gb of memory won't fit in a long. XXX.cpp(84) : error C2664: 'HRESULT BinValue::get(const unsigned char
*&,long &)' : cannot convert parameter 1 from 'unsigned char *' to
'const unsigned char *&'
Conversion loses qualifiers
The compiler is correct. The get() method can change both arguments;
both are non-const references. However, the type of the first
argument does not match the formal parameter. The compiler cannot
introduce a temporary (the usual solution), because temporaries
cannot be bound to a non-const reference.
In 64 bit AMD programming the data type unsigned INT_PTR (unsigned
int*) is UINT_PTR and for unsigned LONG_PTR (unsigned long*) is
ULONG_PTR. What should be the data type for unsigned char* ????


Not important. The type of unsigned char* is unsigned char*. The
type of int* is int*, the type of unsigned int* is unsigned int*,
etcetera. INT_PTR is just a shorter namer, but not a type.
Regards,
Michiel Salters

Jul 22 '05 #2

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

Similar topics

4
by: Carsten Spieß | last post by:
Hello all, i have a problem with a template constructor I reduced my code to the following (compiled with gcc 2.7.2) to show my problem: // a base class class Base{}; // two derived...
110
by: Mr A | last post by:
Hi! I've been thinking about passing parameteras using references instead of pointers in order to emphasize that the parameter must be an object. Exemple: void func(Objec& object); //object...
3
by: Bruno van Dooren | last post by:
Hi All, i have some (3) different weird pointer problems that have me stumped. i suspect that the compiler behavior is correct because gcc shows the same results. ...
35
by: tuko | last post by:
Hello kind people. Can someone explain please the following code? /* Create Storage Space For The Texture */ AUX_RGBImageRec *TextureImage; /* Line 1*/ /* Set The Pointer To NULL...
16
by: junky_fellow | last post by:
According to Section A6.6 Pointers and Integers (k & R) " A pointer to one type may be converted to a pointer to another type. The resulting pointer may cause addressing exceptions if the...
204
by: Alexei A. Frounze | last post by:
Hi all, I have a question regarding the gcc behavior (gcc version 3.3.4). On the following test program it emits a warning: #include <stdio.h> int aInt2 = {0,1,2,4,9,16}; int aInt3 =...
16
by: aegis | last post by:
Given the following: int a = 10; int *p; void *p1; unsigned char *p2; p = &a;
23
by: bluejack | last post by:
Ahoy... before I go off scouring particular platforms for specialized answers, I thought I would see if there is a portable C answer to this question: I want a function pointer that, when...
69
by: fieldfallow | last post by:
Hello all, Before stating my question, I should mention that I'm fairly new to C. Now, I attempted a small demo that prints out the values of C's numeric types, both uninitialised and after...
8
by: Martin Jørgensen | last post by:
Hi, "C primer plus" p.382: Suppose we have this declaration: int (*pa); int ar1; int ar2; int **p2;
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.