& before a function

J

Jianli Shen

Bitvector& ClassName::functionName(Basicblock* bb)

what's the & means here,
is that return a pointer to a Bitvector variable for future use.

Thanks.


--
Sincerely,
Jianli Shen

===================================
Georgia Tech, College of Computing
801 Atlantic Dr, Atlanta, GA 30332
Email: (e-mail address removed)
===================================
 
D

David White

Jianli Shen said:
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
 
M

Marcin Kaliciñski

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.

& can mean reference also in expressions (type casts), not only in
declarations.

M
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
474,202
Messages
2,571,057
Members
47,662
Latest member
sxarexu

Latest Threads

Top