& symbol

Pages: 1... 345
I have been a chairperson and member on ISO standards and I am very confident that the nuances perceived here and dictated by some would not see the light of day in committee and most certainly would not be used to disparage people acting in good faith, to demean their choice of language, question their motives in contributing, grossly exaggerating small and trivial differences, embarrass people asking for help, being accursedly argumentative, accuse contributors of trolling, calling them a liar and generally misbehaving.

Nobody is embarassing anybody looking for help. Nobody has done or said anything to embarass the person who started this thread, for example.

What we have tried to do is help those who genuinely want to learn, by correcting and clarifying misleading (and outright incorrect) information.

When a person responds to people trying to help them learn things, by throwing around childish insults, as jt1 has, then it is very clear that they're not making a "good faith" effort to learn anything.

I'll also note that it's not just this thread. jt1 has recently come into several threads, posted incorrect or misleading stuff, and when others have tried to clarify and correct things, s/he's started throwing around insults. It's no great surprise that people are becoming less and less tolerant of this childish behaviour.
closed account (48T7M4Gy)
Maybe we are talking about different things? I am talking about mixing references and result of address-of operator, and by extent mixing pointers and references.

I think we are. I've always found your posts to be constructive and helpful especially to people with a genuine good spirit. Unfortunately you have joined up with one or two here whose egos are way beyond their ability.

And I can only speak for myself, but I for one won't have my fun spoiled by arrogant egoists, and I don't see why jt1 should either. If he or anybody else needs additional insight or correction then there are many ways to do it. Regrettably, those I am on about, have made the wrong selections - Cire and MikeyBoy spring to mind when I say this.
Last edited on
For the record, the 'official', unambiguous, names (used in the IS) for these operators are
'the unary * operator' and 'the unary & operator'

Boost spirit calls the unary * operator the the kleene operator; because it is used as the Kleene star (in prefix form).

The standard provides std::addressof() because the unary & operator need not always be 'the address-of operator'

Out of idle curiosity, I searched for "address-of operator", "addressof operator" or "address of operator" in the IS and found it in just one place:
The address-of operator & shall not be applied to a bit-field

In a few places, the IS uses the term operator& to allude to the overloaded unary & operator.
template <class T> T* addressof(T& r) noexcept;
Returns: The actual address of the object or function referenced by r, even in the presence of an overloaded operator&.
The address of an object of incomplete type can be taken, but if the complete type of that object is a class type that declares operator&() as a member function, then the behavior is undefined (and no diagnostic is required).
Also on index pages:
&, see operator, address-of, see bitwise AND operator,
see declarator, reference


operator, 22–23, 296
[...]
address-of, 104
Same (aside from page numbers) in latest working draft.
Last edited on
according to this site the reference is used to get the address of a variable. not called
the address-of operator specifically.


Actually, according to that site, the reference operator is used to get the address of a variable. Many of us have said that it is no longer called that in the later C++ standards. But, even assuming that it were still called the reference operator, your statement is wrong. We are trying to tell you that there is something called a reference in C++, specified in context by '&' after a type name, which is not related to an address. When you say that the reference is used to get the address, that is plain wrong. A reference is not involved. The reference operator (obsolete name--now the address-of operator) is used to get the address.

There are web pages out there that haven't been updated (including the tutorial on this site), that still refer to the reference operator. But they never say that the result of the reference operator is a reference--they say that result is an address. A reference is not the same thing as the reference operator or the result of using the reference operator.
Nice healthy discussion and lot for me to digest
MinipAA wrote:

& is context-dependend token
If you see & as binary operator (between two values) it is bitwise and
If you see & as unary operator (before variable) it is address-of operator
if you see & as part of type (after typename) it is reference.

I am accepting this as my answer...Thanks everyone for their efforts..You have been very helpful...
Topic archived. No new replies allowed.
Pages: 1... 345