By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,131 Members | 1,882 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,131 IT Pros & Developers. It's quick & easy.

& before a function

P: n/a
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: ji****@cc.gatech.edu
===================================
Jul 23 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
"Jianli Shen" <ji****@cc.gatech.edu> writes:
Bitvector& ClassName::functionName(Basicblock* bb) what's the & means here,
is that return a pointer to a Bitvector variable for future use.

Not a pointer, a reference.
Jul 23 '05 #2

P: n/a
"Jianli Shen" <ji****@cc.gatech.edu> wrote in message
news:d2**********@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
Jul 23 '05 #3

P: n/a
> 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
Jul 23 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.