Skip to content

Instantly share code, notes, and snippets.

@BSVino
Last active October 16, 2016 23:11
Show Gist options
  • Select an option

  • Save BSVino/585d4c74eb746bdbdf9bd7c60ffffded to your computer and use it in GitHub Desktop.

Select an option

Save BSVino/585d4c74eb746bdbdf9bd7c60ffffded to your computer and use it in GitHub Desktop.
Debugging Sample Program
#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