Thanks to visit codestin.com
Credit goes to github.com

Skip to content

malloc not fully implemented #311

@revvv

Description

@revvv

malloc() does not always work as expected:

// example by MSDev from support discord channel
u16 c = 12;
u16 d = 15;
char cArray[3];
char *dCharPtr = (char*) malloc(sizeof(char)*3);
sprintf(cArray,"%d",c);
sprintf(dCharPtr, "%d", d);
consoleNocashMessage("cArray=%s\n", cArray);
consoleNocashMessage("dCharPtr=%s\n", dCharPtr);

Output should be:

cArray=12
dCharPtr=15

Output is:

cArray=12
dCharPtr=<NULL>

I noticed that you get correct results, if your project is big enough: If .obj files are larger than 35 KB, malloc() works as expected.
This example is big enough: https://github.com/alekmaul/pvsneslib/tree/master/snes-examples/maps/mapbuffer

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions