473,329 Members | 1,512 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,329 software developers and data experts.

(int*&) question

hi:

please take a look at the following code:

void* vp;

int vp_test = 20;

vp = & vp_test;

((int*&)vp) ++;

how to interpret ((int*&)vp) ++?

thanks,

bo

Jul 22 '05 #1
1 1308

"Bo Sun" <b0*****@cs.tamu.edu> wrote in message
news:Pi*******************************@unix.cs.tam u.edu...
hi:

please take a look at the following code:

void* vp;

int vp_test = 20;

vp = & vp_test;

((int*&)vp) ++;

how to interpret ((int*&)vp) ++?

thanks,

bo


int *& is a reference to a pointer to int. After the cast, you've got
something that's referring to (i.e. is an alias for) a pointer to int. You
then increment that pointer by the size of one int (4 bytes on most
architectures). The result is then simply discarded since you do nothing
with it.
Jul 22 '05 #2

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

Similar topics

2
by: CoolPint | last post by:
Can anyone clearly explain the difference between constant reference to pointers and reference to constant pointers? What is const int * & ? Is it a constant reference to a pointer to an...
12
by: jeffc | last post by:
Can anyone point me to a web site that gives technical reasons that pass by value is preferred over pass by reference when the value is not to be changed? Actually it could be any built-in "small"...
7
by: Shan | last post by:
Hi all, In the following code the line *(int *)&i = 11; is confusing to me. What is it doing ? #include<iostream> using namespace std; int main() { const int i = 10; *(int *)&i = 11;
8
by: aling | last post by:
Given following code snippets: int a; int* p=(int*)((&a)+1); when I debuged the code using IDE like VC7.1, I found that: a = 0x0012fc50 (int ) p = 0x0012fc78 (int *) (&a)+1 = 0x0012fc51...
16
by: | last post by:
I saw this code in C++ but when tried to C causes an error: ------------- void function(int &a) { a = 5; } ------------- with this, passed in "function" the "a" pointer instead of "a" value, BUT...
3
by: Michael | last post by:
Hi, I am a little confused about & and int &. Do they both mean reference? int a; int* b= & a ; (& here mean reference of a) int& b = a ; ( How to understand & precisely here?) Thanks...
0
by: liujiaping | last post by:
The code is as follows: 1 #include <iostream> 2 3 using namespace std; 4 5 int main() 6 { 7 float a = 1.0f; 8 cout << (int)a << endl; 9 cout << (int&)a << endl;
4
by: 9lives.9lives | last post by:
Hello, everyone! I am trying to optimize some code, but I don't think I'm doing what I think I'm doing. I profiled my code and found that the overloaded operator of my monomial class did...
8
by: RN1 | last post by:
The book I am referring to learn ASP states the following about the Int & Fix VBScript Maths functions: ========================================= Both Int & Fix return the integer portion of the...
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: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
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...
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)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.