Monday 15 March 2010

c++ - Expand _In_ to const -



c++ - Expand _In_ to const -

except fact, confuse every windows c++ developer out there,

wouldn't prudent expand _in_ mandatory const (if not present) ensure const correctness?

so

int dosomething( _in_ int * pinput);

becomes

int dosomething( const int * pinput);

obviously _[in]out_ should still expand nothing.

edit: first problem that, makes sense when expanding in front of pointer or reference parameter.

so maybe simpke macro expansion not suffice. don't want abandon notion of enforcing const yet. motto is: have sal notation tells parameter ro , not, let's create utilize of it.

assuming it's macro expansion, wouldn't work values copied parameters, i.e.

void f( _in_ x x) { g(++x); // ok modify }

c++ const-correctness sal

No comments:

Post a Comment