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

gcc and GCVT(3) #1711

Open
d3vv opened this issue Aug 2, 2019 · 1 comment
Open

gcc and GCVT(3) #1711

d3vv opened this issue Aug 2, 2019 · 1 comment

Comments

@d3vv
Copy link

@d3vv d3vv commented Aug 2, 2019

Code example:

#include <stdlib.h>

void main()
{
	char buf[50];
	char * str = gcvt(3.141592653589793238462643383279502884197169399375, 49, buf);
}

And we have:

$ gcc msys2_err.c
msys2_err.c: In function ‘main’:
msys2_err.c:6:15: warning: implicit declaration of function ‘gcvt’ [-Wimplicit-function-declaration]
    6 |  char * str = gcvt(3.141592653589793238462643383279502884197169399375, 49, buf);
      |               ^~~~
msys2_err.c:6:15: warning: initialization of ‘char *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
  1. Why we have "implicit declaration of function"? If from:

MSVC: https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/gcvt?view=vs-2019
Linux man: http://man7.org/linux/man-pages/man3/gcvt.3.html
And from IBM: https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.3.0/com.ibm.zos.v2r3.bpxbd00/rgcvt.htm

gcvt must be into stdlib.h as well!

  1. Why we have "incompatible integer to pointer conversion"? If declaration from all standards looks like:

char *gcvt(double number, int ndigit, char *buf);

And where is the "int" here? What include must be into MSYS2 for gcvt?

@d3vv
Copy link
Author

@d3vv d3vv commented Aug 2, 2019

I post all found issues here:

https://cygwin.com/ml/cygwin/2019-08/msg00030.html

but mys post to mail-list looks like not readable :(((

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

Successfully merging a pull request may close this issue.

None yet
1 participant