|
dev.gamez.lv Latvian Game Developers Community
|
View previous topic :: View next topic |
Author |
Message |
Angel
Joined: 02 Jan 2005 Posts: 113 Location: Latvija
|
Posted: Tue Jul 19, 2005 8:48 pm Post subject: const char* un char* const |
|
Ieprieksh nebiju ieveerojis, ka const char* un char* const, nav viens un tas pats. Bet tagad gribeeju uzzinaat ko dara char* const jo par const char* it kaa buutu skaidrs... _________________
|
|
Back to top |
|
|
GiGa Indago Uzvarētājs
Joined: 25 Sep 2003 Posts: 887
|
Posted: Tue Jul 19, 2005 8:58 pm Post subject: |
|
Smalkas lietas shito arii ieprieksh nezinaaju :)
Quote: |
[18.5] What's the difference between "const Fred* p", "Fred* const p" and "const Fred* const p"?
You have to read pointer declarations right-to-left.
const Fred* p means "p points to a Fred that is const" — that is, the Fred object can't be changed via p.
Fred* const p means "p is a const pointer to a Fred" — that is, you can change the Fred object via p, but you can't change the pointer p itself.
const Fred* const p means "p is a const pointer to a const Fred" — that is, you can't change the pointer p itself, nor can you change the Fred object via p.
|
Njemts no: http://www.parashift.com/c++-faq-lite/const-correctness.html _________________
|
|
Back to top |
|
|
Angel
Joined: 02 Jan 2005 Posts: 113 Location: Latvija
|
Posted: Tue Jul 19, 2005 9:20 pm Post subject: |
|
baaaaaaaaaaaaa, pieleca tikai peec 4 izlasiishanas reizes _________________
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|