Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse C Strings in ABI #6

Open
5265644D61736F6E opened this issue Nov 11, 2020 · 0 comments
Open

Parse C Strings in ABI #6

5265644D61736F6E opened this issue Nov 11, 2020 · 0 comments

Comments

@5265644D61736F6E
Copy link
Contributor

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'?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant