|
-
April 27th, 2009, 07:59 PM
#1
[RESOLVED] Const correctness: const * const vs const &
I've never paid much attention to const correctness and have usually relied on my knowledge of the code to determine what I can and cannot modify. I feel this is a bad habit I need to get rid of. (for the sake of working with other programmers mainly) So I've started to change the current program I'm writing by applying const were needed.
However, my question is: Is there any difference between using a constant pointer to a constant variable (const * const) and a constant reference (const &)? To me it looks like they offer exactly the same limitation to the variable. What is considered good practise among C++ programmers? Or is it both okay as long as I am consistent?
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|