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

Address-of operator

What does it mean that "C++ silently write and call address-of operators"?
Jul 19 '05 #1
7 4934
Stub wrote:
What does it mean that "C++ silently write and call address-of operators"?


It doesn't seem to mean anything. Why don't you provide the complete
context for this fragment?

--
Best regards,
Andrey Tarasevich

Jul 19 '05 #2
"Stub" <st**@asof.com> wrote in message news:<yX*********************@bgtnsc05-news.ops.worldnet.att.net>...
What does it mean that "C++ silently write and call address-of operators"?


It means that you do not have to explicitally write 'operator &', just
as you dont have to write 'operator ='. C++ will silently provide its
own implementation.

Regards,
Nilesh Dhakras
Jul 19 '05 #3

"Nilesh" <dh*******@hotmail.com> wrote in message news:ae**************************@posting.google.c om...
"Stub" <st**@asof.com> wrote in message news:<yX*********************@bgtnsc05-news.ops.worldnet.att.net>...
What does it mean that "C++ silently write and call address-of operators"?


It means that you do not have to explicitally write 'operator &', just
as you dont have to write 'operator ='. C++ will silently provide its
own implementation.

Actually that is not true. No implementation is provided by default.
& is just one of those operators that has a native meaning when not
overloaded. This is distinct from the copy assignment operator which
when not declared is implicitly generated.

This is a subtle distinction but examine the following program:

#include <iostream>
using namespace std;

struct B {
B* operator&() {
cout << "B::operator&()\n";
return this;
}
};

struct D : B {
};

int main() {
D d;
&d;
return 0;
}

In this case the &d expression invokes the inheritted B::operator&. If there was an implicitly
generated one (as C++ does for operator=), then the one in B would be hidden and not used.


Jul 19 '05 #4

Nilesh wrote:
"Stub" <st**@asof.com> wrote in message news:<yX*********************@bgtnsc05-news.ops.worldnet.att.net>...
What does it mean that "C++ silently write and call address-of operators"?


It means that you do not have to explicitally write 'operator &', just
as you dont have to write 'operator ='. C++ will silently provide its
own implementation.


No, there's absolutely nothing in common between copy assignment
operator and operator '&' in this respect. C++ does not "provide its own
implementation" for member operator &, silently or not.

--
Best regards,
Andrey Tarasevich

Jul 19 '05 #5
> No, there's absolutely nothing in common between copy assignment
operator and operator '&' in this respect. C++ does not "provide its own
implementation" for member operator &, silently or not.


I thought it does, unless you define own = operator, copy the members using
their respective = operators. What is the correct wording of this? Seems
that is the only thing you disagree about as far as I can tell.

-w-
Jul 19 '05 #6
wogston wrote:
No, there's absolutely nothing in common between copy assignment
operator and operator '&' in this respect. C++ does not "provide its own
implementation" for member operator &, silently or not.


I thought it does, unless you define own = operator, copy the members using
their respective = operators. What is the correct wording of this? Seems
that is the only thing you disagree about as far as I can tell.
...


I'm talking about 'operator &'. Once again, C++ does not "provide its
own implementation" for member 'operator &', silently or not.

As for the copy assignment operator, you are right. If you don't declare
one in your class, the compiler will implicitly declare one for you (and
define it, if necessary and possible).

--
Best regards,
Andrey Tarasevich

Jul 19 '05 #7
"Ron Natalie" <ro*@sensor.com> wrote in message news:<3f***********************@news.newshosting.c om>...
"Nilesh" <dh*******@hotmail.com> wrote in message news:ae**************************@posting.google.c om...
"Stub" <st**@asof.com> wrote in message news:<yX*********************@bgtnsc05-news.ops.worldnet.att.net>...
What does it mean that "C++ silently write and call address-of operators"?


It means that you do not have to explicitally write 'operator &', just
as you dont have to write 'operator ='. C++ will silently provide its
own implementation.

Actually that is not true. No implementation is provided by default.
& is just one of those operators that has a native meaning when not
overloaded. This is distinct from the copy assignment operator which
when not declared is implicitly generated.


Thanks Ron for this clarification.

Nilesh Dhakras.
Jul 19 '05 #8

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

Similar topics

2
by: jason | last post by:
Hello and Good day. There's a site I want to link to passing info I collect without having to re-enter the data on that's sites input form. I know this is not always possible, but in this case...
2
by: Keith Langer | last post by:
I have a TCPListener which needs to listen on my LAN IP as well as the loopback address. In VS.Net 2002 the TCPListener constructor could accept the port as an argument and it automatically bound...
1
by: Roman Mashak | last post by:
Hello, All! I just started to learn Perl, and don't know exactly what regexp I can use to get IP address from 'ifconfig' routine. My system is linux, so output is the following: eth0 Link...
117
by: Steevo | last post by:
Any suggestions as to the best programs for cloaking email addresses? Many thanks -- Steevo
11
by: farqs | last post by:
I've got a form with feilds: Address, Suburb, State, Pcode (for the Location Addres) and then: PAddress, PSuburb, PState, PPcode (for the Postal Address). When the postal address is the same as...
4
by: andreas.w.h.k. :-\) | last post by:
How do I change the address location in the wsdl <wsdl:port name="SearchSoap12" binding="tns:SearchSoap12"> <soap12:address location="http://searchservices/engine/search.asmx" /> </wsdl:port> ...
13
by: Sandeep Singh | last post by:
I am making socket client application in C# how can i get ip address of client who has connected to server
1
by: saravanatmm | last post by:
I need javascript code for validate the email address. Email address field cannot allowed the capital letters, special characters except '@' symbol. But can allowed the small letters, numeric...
10
by: Mike Miller | last post by:
Hi, Am wanting to send email with php and need to access the global outlook address book. Are there any examples/tutorials on how to do this? M
15
by: Mike | last post by:
Hi ASP Gurus, Please help me solving my problem. I am trying to get the clients IP address but I am not able to do it successfully. I have tried: Request.ServerVariables("http_user_agent")...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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,...
0
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...

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.