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

Convert char** se parameters to CONST (break with C standard #12

Open
phillipjohnston opened this issue Aug 1, 2018 · 1 comment
Open

Comments

@phillipjohnston
Copy link
Member

There's lots of const casting around:

	if (se)
		*se = (char*)s;

This generates a warning, and I am happy:

[60/63] Compiling C object 'src/src@@@c_native@sta/gdtoa_src_strtodg.c.o'.
../src/gdtoa/src/strtodg.c:1016:16: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual]
                *se = (char*)s;

The standard doesn't specify this argument as a const char *, even though we pass in a const char string. Most implementations cast away const.

So I want to make a better version of the libc headers which keeps this const. You can cast it away on your own time if you need to.

@phillipjohnston
Copy link
Member Author

The signature to look for is:

	if (se)
		*se = (char*)(uintptr_t)s;

I am sad that I had to do it.

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