First page Back Continue Last page Overview Graphics

Advarsler, udrag: 1537

1537 const function returns pointer data member 'Symbol' -- A const function is behaving suspiciously. It is returning a pointer data member (or equivalently a pointer to data that is pointed to by a data member). For example,

class X

{

int *p;

int *f() const { return p; }

};

Since f is supposedly const and since p is presumptively pointing to data that is logically part of class X we certainly have the potential for a security breach. Either return a pointer to const or remove the const modifier to the function. [12, Item 29].

Note, if a const function returns the address of a data member then a 605 (capability increase) is issued.


Notes:

Den fulde hjælpetekst til en FlexeLint-advarsel kan åbne ens øjne for problemer.