Code: Select all
JSL::JSL()
{
bran_flakes = 44; //its 44 I'm pretty sure
};
[...]
printf("OMG I have %f bran flakes\n", jsl->bran_flakes);
Moderator: PC Supremacists
Code: Select all
JSL::JSL()
{
bran_flakes = 44; //its 44 I'm pretty sure
};
[...]
printf("OMG I have %f bran flakes\n", jsl->bran_flakes);
Gyro Sheen wrote:you pour their inventory onto my life
IRC wrote: <sparda> The routine had a stack overflow, sorry.
<sparda> Apparently the stack was full of shit.
Code: Select all
class dildo {
int member_A; //Member data (private)
string asswranger; //Member data (private)
public:
dildo():member_A(44),asswrangler("twat") {std::cout << "def constr call";}
~dildo();
//at the end of this func, x and y are out of scope, and asswrangler is "twathole"
void func_A() {
int x,y;
x=y=0;
asswranger+="hole";
}
//at the end, x is out of scope and member_A=whatever the fuck you passed
void func_B(int x) {
member_A=x;
}
};
Also, bran_flakes is not a pointer, so you would use the dot operator (.) rather than the indirection operator (->)printf("OMG I have %f bran flakes\n", jsl->bran_flakes);
but jsl is...well at least in my versionArce wrote:Also, bran_flakes is not a pointer, so you would use the dot operator (.) rather than the indirection operator (->)printf("OMG I have %f bran flakes\n", jsl->bran_flakes);
Code: Select all
JSL *jsl = new JSL();
printf("OMG I have %f bran flakes\n", jsl->bran_flakes);
Gyro Sheen wrote:you pour their inventory onto my life
IRC wrote: <sparda> The routine had a stack overflow, sorry.
<sparda> Apparently the stack was full of shit.
Code: Select all
class dildo {
int member_A; //Member data (private)
public:
dildo():member_A(44)
{
std::cout << "member_A is " << member_A;
hey();
}
~dildo();
void hey() { member_A = 55; }
void corn() { std::cout << "WTF is member_A? " << member_A; }
};
Small girl at the harbor wrote:Look Brandon, that crab's got ham!
Gyro Sheen wrote:you pour their inventory onto my life
IRC wrote: <sparda> The routine had a stack overflow, sorry.
<sparda> Apparently the stack was full of shit.
Small girl at the harbor wrote:Look Brandon, that crab's got ham!
Lesson learned: If you delete your class instance C++ fucks your mother but doesn't tell you.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches!
Haha yeah. Interpreting the ascii data is pretty ridiculous. Check out what it has to do when it sees a blue pipe "B"...Arce wrote:Also, I like your neat little way of saving/loading shit. Looks pretty tight to see an ascii level. ;p
Code: Select all
case 'B':
mapt[x][y] = 0;
xv=0; yv=0;
if(mapt[x+1][y] == 'b') {
xv=1; yv=0;
} else if(mapt[x][y+1] == 'b') {
xv=0; yv=1;
} else if(mapt[x-1][y] == 'b') {
xv=-1; yv=0;
} else if(mapt[x][y-1] == 'b') {
xv=0; yv=-1;
}
if(xv!=0)
{
for(i=1; ; i++)
{
map[x+((i-1)*xv)-1][y-1][1] = '.';
if(mapt[x+(i*xv)][y] != 'b')
{
stageObjects.push_back(new pipe(BLUE, HORZ, x-1, y-1, x+((i-1)*xv)-1));
break;
}
}
map[x-1][y-1][1] = '+';
}
if(yv!=0)
{
for(i=1; ; i++)
{
map[x-1][y+((i-1)*yv)-1][1] = '.';
if(mapt[x][y+(i*yv)] != 'b')
{
stageObjects.push_back(new pipe(BLUE, VERT, x-1, y-1, y+((i-1)*yv)-1));
break;
}
}
map[x-1][y-1][1] = '-';
}
break;
Small girl at the harbor wrote:Look Brandon, that crab's got ham!
Wow!! I bet if I read that I would understand all of itJS Lemming wrote:Thanks guys.Haha yeah. Interpreting the ascii data is pretty ridiculous. Check out what it has to do when it sees a blue pipe "B"...Arce wrote:Also, I like your neat little way of saving/loading shit. Looks pretty tight to see an ascii level. ;p
Code: Select all
case 'B': mapt[x][y] = 0; xv=0; yv=0; if(mapt[x+1][y] == 'b') { xv=1; yv=0; } else if(mapt[x][y+1] == 'b') { xv=0; yv=1; } else if(mapt[x-1][y] == 'b') { xv=-1; yv=0; } else if(mapt[x][y-1] == 'b') { xv=0; yv=-1; } if(xv!=0) { for(i=1; ; i++) { map[x+((i-1)*xv)-1][y-1][1] = '.'; if(mapt[x+(i*xv)][y] != 'b') { stageObjects.push_back(new pipe(BLUE, HORZ, x-1, y-1, x+((i-1)*xv)-1)); break; } } map[x-1][y-1][1] = '+'; } if(yv!=0) { for(i=1; ; i++) { map[x-1][y+((i-1)*yv)-1][1] = '.'; if(mapt[x][y+(i*yv)] != 'b') { stageObjects.push_back(new pipe(BLUE, VERT, x-1, y-1, y+((i-1)*yv)-1)); break; } } map[x-1][y-1][1] = '-'; } break;
JS Lemming wrote:Holy fucking shit. I am theeeeee dumbest dumb shit alive. Wow. Woooooow.
Ok guys... Wow. Sooo it turns out I deleted the instance of the class right after I made the instance (for debugging purposes a few days ago) and had forgotten to remove the delete... And the fact that it still fucking worked (aside from this member variable abomination) when I called on functions in the no longer existing instance is why I didn't catch the delete till just now. Once again... Wow.
Lesson learned: If you delete your class instance C++ fucks your mother but doesn't tell you.
Gyro Sheen wrote:you pour their inventory onto my life
IRC wrote: <sparda> The routine had a stack overflow, sorry.
<sparda> Apparently the stack was full of shit.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches!
That's were they lost me too...dandymcgee wrote:Your variable names make my head hurt.