Skip to content

Parse C Strings in ABI #6

@5265644D61736F6E

Description

@5265644D61736F6E

Unlike implementations of string functions like strlen(const char*), some langcraft built-in functions require a length parameter. For example:

extern void insert_asm(const char* cmd,int len,int arg);

int main() {
    insert_asm("kill @e",7,0);
}

C strings are null-terminated, or contain a '\0' character to signify the end of a string. Implementations of string functions generally look for the null character to determine a string's length.

I'm not certain why langcraft doesn't do this. Could langcraft determine the end of a string with '\0'?

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