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

Dereferencing pointers

Is

*(pointer1->pointer2)

The same as

(*(*pointer1).pointer2)

TYIA

nifsmith
Jul 22 '05 #1
5 1994

"nifsmith" <ha*********@lycos.co.uk> wrote in message
news:cl**********@sparta.btinternet.com...
Is

*(pointer1->pointer2)

The same as

(*(*pointer1).pointer2)

TYIA

nifsmith


Yes.

john
Jul 22 '05 #2

"nifsmith" <ha*********@lycos.co.uk> wrote in message
Is

*(pointer1->pointer2)

The same as

(*(*pointer1).pointer2)


Yes.
Section 5.2.5 paragraph 3 - "If E1 has the type ``pointer to class X,'' then
the expression E1->E2 is converted to the equivalent form (*(E1)).E2;"

Sharad
Jul 22 '05 #3
nifsmith posted:
Is

*(pointer1->pointer2)

The same as

(*(*pointer1).pointer2)

TYIA

nifsmith

Yes, it is for *pointers*.
Note however, that for acutal objects, it doesn't always hold true.
For instance:
struct Monkey
{
int* tail;
};
class Blah
{
public:

Monkey a;

Monkey b;

Monkey& operator*()
{
return a;
}

Monkey& operator->()
{
return b;
}
};
int main()
{
Blah poo;

int k;

*( poo->tai l) = &k;

*( (*poo).tail ) = &k;
}
In that above, the statements do two totally different things, ie. there's
two different "tail"s!

(Actually now as I'm writing this, I'm not 100% sure that you can overload
->)
-JKop
Jul 22 '05 #4

"JKop" <NU**@NULL.NULL> wrote in message
news:X3*******************@news.indigo.ie...
[...]
(Actually now as I'm writing this, I'm not 100% sure that you can overload
->)


Yes you can

Catalin
Jul 22 '05 #5
Catalin Pitis posted:

"JKop" <NU**@NULL.NULL> wrote in message
news:X3*******************@news.indigo.ie...
[...]
(Actually now as I'm writing this, I'm not 100% sure that you can
overload ->)


Yes you can

Catalin


This pleases me!

( C++, 1 point, Bullshit, 0 points )
-JKop
Jul 22 '05 #6

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

Similar topics

2
by: Matthias | last post by:
Hi, again, I have a problem using containers of pointers (I'm near to the point to drop them alltogether and work on usual containers instead...). The problem is, if I want to perform some...
51
by: BigMan | last post by:
Does the C++ standard define what should happen in case of NULL pointer dereferencing. If not, does it say that it is illegal? Where, if so, does it say it?
2
by: Dennis Jones | last post by:
Hello, Given something like: boost::shared_ptr<T> t( new T() ); What is the best (correct?) way to dereference the pointer? The following two methods work. Is there a difference?
28
by: Martin Jørgensen | last post by:
Hi, I have a "funny" question, which I think is pretty "healthy" to examine... This program is being investigated: - - - - - - - #include <iostream> using namespace std; #define DAYS 7
4
by: Pritam | last post by:
line 7: error: dereferencing pointer to incomplete type 1. #include<stdio.h> 2. #include<sys/stat.h> 3. #include<stdlib.h> 4. void execname() { 5. struct task_struct *my; 6. my =...
1
by: David Mathog | last post by:
We've established that a line of code like: (void) function( (long *) &(something) ); may (and probably should) generate one of these warning: dereferencing type-punned pointer will break...
20
by: prashant.khade1623 | last post by:
I am not getting the exact idea. Can you please explain me with an example. Thanks
6
by: jorba101 | last post by:
I'm developing an application with GCC 3.4 for ARM7. When doing following: T_f32 temp_f32; T_u32 temp_u32; temp_u32 = *((T_u32 *) &temp_f32); (where T_u32 is unsinged int, and T_f32 is...
12
by: viza | last post by:
Hi I have program1.c: typedef int (*fn_t)(int); int fn( int f ){ return f; }
3
by: sritejv | last post by:
Hello everyone, I am having a problem with typecasting void pointers.I have read the pointer basics but still cant understand why the following test code doesnt work. void *xyz; struct abcd...
1
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...
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...

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.