Last active
October 16, 2016 23:11
-
-
Save BSVino/585d4c74eb746bdbdf9bd7c60ffffded to your computer and use it in GitHub Desktop.
Debugging Sample Program
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "stdafx.h" | |
| #include <vector> | |
| struct Widget { | |
| int a, b, c, d; | |
| long f; | |
| long g[10]; | |
| long h; | |
| }; | |
| struct Doodad { | |
| std::vector<Widget> widgets; | |
| virtual int VFn1(int index) { return 12; } virtual int VFn2(int index) { return 12; } | |
| virtual int DoFinalDad(int index) { return 12; } | |
| virtual int DoTheDad(int index) { return 13; } | |
| int DoAnotherDad(int index) { | |
| return widgets[index%widgets.size()].h; | |
| }; | |
| __declspec(noinline) int NotInline(int index) { | |
| return DoFinalDad(DoTheDad(index) + DoAnotherDad(index)); | |
| } | |
| }; | |
| struct Doodad2 : public Doodad { | |
| Doodad2(int index) { | |
| for (int k = 0; k < 50; k++) { | |
| widgets.push_back({ k+index, k+index+1, k+index+2, k+index+3, k+index+4, k+index+5 }); | |
| } | |
| } | |
| virtual int DoFinalDad(int index) { return 24; }; | |
| virtual int DoTheDad(int index) { | |
| return widgets[index].f * widgets[index].d; | |
| } | |
| }; | |
| int main(int argc, const char** args) | |
| { | |
| int index = atoi(args[1]); | |
| Doodad2 doodad(index); | |
| return doodad.NotInline(index); | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment