nibblebits / PeachCompiler

A C compiler created for the how to create a C Compiler online course
GNU General Public License v2.0
83 stars 36 forks source link

Issue about calculating secondary data type size. #11

Open zzdmfk opened 1 year ago

zzdmfk commented 1 year ago

When I declared variables like below:

short int a; long int b;

Data type sizes were calculated wrong In function:

void parser_datatype_adjust_size_for_secondary(struct datatype* datatype, struct token* datatype_secondary_token)
{
    if(!datatype_secondary_token)
        return;

    struct datatype* secondary_data_type = calloc(1, sizeof(struct datatype));
    parser_datatype_init_type_and_size_for_primitive(datatype_secondary_token, NULL, secondary_data_type);
    datatype->size += secondary_data_type->size;
    datatype->datatype_secondary = secondary_data_type;
    datatype->flags |= DATATYPE_FLAG_IS_SECONDARY;
}

short int a; //datatype->size=6 long int b; //datatype->size=8

nibblebits commented 1 year ago

Yes the secondary datatype has been miscalculated thats for bringing this to my attention it will be resolved

nibblebits commented 1 year ago

Thanks *

nibblebits commented 6 days ago

Hello, Thanks for reaching out, once theres enough issue reports I will go through them all and create a lecture addressing any issues.

Thanks Dan