Re: & before a function

From: David White (no_at_email.provided)
Date: 03/30/05


Date: Wed, 30 Mar 2005 16:35:55 +1000


"Jianli Shen" <jianli@cc.gatech.edu> wrote in message
news:d2dbm5$pd9$1@news-int2.gatech.edu...
> Bitvector& ClassName::functionName(Basicblock* bb)
>
> what's the & means here,
> is that return a pointer to a Bitvector variable for future use.

No, it returns a _reference_ to a Bitvector for future use. The & as part of
a type declaration is unrelated to the & operation that takes the address of
an object. You can always tell what & means from the context (ignoring
operator overloads). In a type declaration it's always a reference, and in
an expression it's either the unary address-of operation or the binary
bitwise AND operation.

DW



Relevant Pages

  • Re: Question on LSP
    ... Sure, the developer must keep track of which type has been assigned to each pointer to manage complexity in creating the design, which is why the 'T' is in T*. ... Subtyping is a relation which does not ... Those object types are completely orthogonal to the semantics of being an object reference. ... aggregate references, is the aggregate of referenced objects or target ...
    (comp.object)
  • Re: Question on LSP
    ... Because construction paradigms have different goals. ... But that has nothing to do with what a pointer type ... But that does not mean that the semantics of an object reference is ... aggregate references, is the aggregate of referenced objects or target ...
    (comp.object)
  • Re: Modifying Class Object
    ... Before I start, note we're talking about semantics, not ... For example, as I used as reference in my first posting, the Java language spec. ... A pointer stores a reference to something. ...
    (comp.lang.python)
  • Re: Question on LSP
    ... equivalent addresses in the same context. ... Note that the language allows us to use a name like 'T' on the reference as a mnemonic so that the developer can keep track of what is happening with the indirection. ... Modern languages have proper pointer types. ...
    (comp.object)
  • Re: Nothing Keyword Destories Objects rather than just resetting the variable to an empty variable
    ... there is no difference between using ByVal or ByRef. ... as the C1 pointer was the sole reference to the class object. ... Yes, an object variable is a pointer to an object, but that is the only ... the keyword "NOTHING" should only destroy the ...
    (microsoft.public.excel.programming)