More on the game einstein

I have been wandering about the "einstein" code for some time, in the same way that I play the game in my off times. I ran into this, which is more than questionable and accounts for odd behavior of some programs. I am not really sure what g++ did with this, but I am guessing that ".h" did not get recompiled like a person would think. It makes for odd stuff and life is strange enough, without adding complexity.

    public:
        int add(const std::wstring &name, int scores);
        void save();
        ScoresList& getScores();
        int getMaxScore();

        bool isFull();
//        bool isFull() { return scores.size() >= MAX_SCORES; };

The line which is commented out is executable code and here is what happens in the assembled code. The quote below about GCC is for the sake of reference if you want more information in your assembly file.

Artur Krzysztof Szostak writes:
 > Is there a way to make GCC output the source code comments or corresponding 
 > c++ source code that generated a set of assembler instructions in the .s 
 > files?

Yes.

-Wa,-adhls

Andrew.

This is the code generated. I did a diff with grep -v to remove some stuff and it got me the stuff I wanted to look at. I have gotten tired of looking for what really happened and have accepted that there are certain things that a person shouldn't normally do and putting real functions in in a header file is one of those things to avoid.

.LCFI108:
 movq %rdi, -8(%rbp)
 movq -8(%rbp), %rdi
 call _ZNKSt4listIN9TopScores5EntryESaIS1_EE4sizeEv
 cmpq $14, %rax
 seta %al
 movzbl %al, %eax

I suppose all of this looks like gibberish to most people. But, I speak gibber fluently :)

0 comments:

Automated Intelligence

Automated Intelligence
Auftrag der unendlichen LOL katzen