__STRICT_ANSI__ and stdio.h

KIMURA Masaru hiyuh.root@gmail.com
Mon Dec 14 04:56:00 GMT 2015


Hi,

>> is cygwin's __STRICT_ANSI__ and stdio.h behavior not so compatible to glibc's?
>> especially, i meant routines in POSIX 1003.1:2001 (popen(), pclose(), etc).
>> for a specific example, see a cparser issue[1] i submitted.
>>
>
> Cygwin isn't wrong.  __STRICT_ANSI__ doesn't mix with POSIX.
> __STRICT_ANSI__ definitions is what you should look at for the defined
> API; not POSIX 1003.1:2001.

then why does glibc look accepting -std=c99 -D_POSIX_C_SOURCE=200809L?
so you mean linux (maybe glibc?) is wrong and cygwin (maybe newlib?) is right?

w/ attached source that uses popen()/pclose() via gcc -std=c99,

on cygwin (maybe newlib?), i got,
p.c: In function ‘main’:
p.c:5:2: warning: implicit declaration of function ‘popen’
[-Wimplicit-function-declaration]
  FILE *pp = popen("cat", "w");
  ^
p.c:5:13: warning: initialization makes pointer from integer without a cast
  FILE *pp = popen("cat", "w");
             ^
p.c:12:3: warning: implicit declaration of function ‘pclose’
[-Wimplicit-function-declaration]
   int err = pclose(pp);
   ^

on linux (maybe glibc?), i got,
p.c: In function 'main':
p.c:4:14: warning: unused parameter 'argc' [-Wunused-parameter]
 int main(int argc, char *argv[]) {
              ^
p.c:4:26: warning: unused parameter 'argv' [-Wunused-parameter]
 int main(int argc, char *argv[]) {

                          ^                          ^

Peace,

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list