cat4rsys / stack

0 stars 0 forks source link

Bug in stack ctor #1

Open Carvalanga opened 3 weeks ago

Carvalanga commented 3 weeks ago

Hello, roommate! I found a bug in your code. If you try to create stack witch size is too big you program will crash! Look at this code in main:

#include "stack.h"
#include "log.h"
#include <cstdio>

int main()
{
    Stack stk = {}; //

    stk.logFile = fopen("logfile.htm", "w");
    logInit(stk.logFile);

    DO_STACK_CTOR(&stk, 10000000000000000);
    DO_STACK_PUSH(&stk, 20);
    printf("DONE\n");

    DO_STACK_DTOR(&stk);

    return 0;
}
cat4rsys commented 3 weeks ago

Hello, stack ctor is working normally(as I think) and with bug caused not by this function :)