Skip to main content
gamedev.net
🔒 Locked

mutable syntax question (solved)

Started by 255 Dec 2, 2005 at 12:28 PM 4 replies 1.1k views
Original Post
255
255
How do I declare a mutable pointer to a const object in C++? gcc 4 seems to accept const Obj mutable *p; but gcc 3.3 says symbols.hpp:369: error: declaration does not declare anything symbols.hpp:369: error: syntax error before `mutable' [Edited by - 255 on December 2, 2005 12:55:21 PM]
255
255
const Obj * mutable p; does not work either (on either gcc version).
RDragon1
RDragon1
mutable const Obj* p;, just like mutable int i;
255
255
Ok, thanks. The way my editor colored mutable made me assume it behaved syntactically like const while it behaves more like virtual. Any idea if my original form (const Obj mutable *p;) is also valid since gcc 4 accepted it?
moeron
moeron
I dunno about the actual standard but MSVC 2003/05 only accept mutable const foo* pPtr;
moe.ron

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.