Built-in functions returning incorrect results

I have a great application that I'm working on in C ++, and we have a class in which the built-in functions return the wrong value. It looks like they are offset by one record.

Here is an example code setup:

class Test
{

private:
    uint myVal1;    
    uint myVal2;
    uint myVal3;
    uint myVal4;

public:
    uint myFunct1() const { return myVal1 };
    uint myFunct2() const { return myVal2 };
};

What we see is that myFunct1 returns myVal2, and myFunct2 returns myVal3. If I do not perform the functions, everything works as expected.

Any ideas on why this is happening?

Thanks in advance.

+3
source share
2 answers

(I assume that what you posted above is actually a snippet from some header file.)

, , , . - - .

Test , . Test , , . - .

- , , , . "" ( ), , , . .

, .

PS , - , .

"" , (.. "" #ifdef/#endif). #define - - , , .

+11

, () , . , - , , . , ?

+3

Source: https://habr.com/ru/post/1790843/


All Articles