From: SourceForge.net <no...@so...> - 2007-10-20 12:45:31
|
Bugs item #1815861, was opened at 2007-10-18 10:57 Message generated for change (Comment added) made by ir0nh34d You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=102435&aid=1815861&group_id=2435 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: mingw runtime Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: maXmo (maxxmo) Assigned to: Chris Sutcliffe (ir0nh34d) Summary: wchar.h and stdio.h - keep in sync Initial Comment: in wchar.h #ifdef __MSVCRT__ ...... #ifndef __STRICT_ANSI__ ...... _CRTIMP FILE* __cdecl __MINGW_NOTHROW _wfopen (const wchar_t*, const wchar_t*); ...... #endif /* __STRICT_ANSI__ */ ...... #endif /* __MSVCRT__ */ but in stdio.h there is no __STRICT_ANSI__ check: #ifdef __MSVCRT__ ...... _CRTIMP FILE* __cdecl __MINGW_NOTHROW _wfopen (const wchar_t*, const wchar_t*); ...... #endif /* __MSVCRT__ */ Which one is correct? ---------------------------------------------------------------------- >Comment By: Chris Sutcliffe (ir0nh34d) Date: 2007-10-20 08:45 Message: Logged In: YES user_id=570619 Originator: NO Are we safe to close this issue? ---------------------------------------------------------------------- Comment By: maXmo (maxxmo) Date: 2007-10-19 12:34 Message: Logged In: YES user_id=1122376 Originator: YES actual problem was "for loop initialization outside C99", I tried to use -std=c99 and got warning _wfopen: implicit function declaration. I've digged up this defference between wchar.h and stdio.h and I was unsure whether I can use _wfopen with "for loop...". It turned out to work fine with -std=gnu99. ---------------------------------------------------------------------- Comment By: Keith Marshall (keithmarshall) Date: 2007-10-19 06:04 Message: Logged In: YES user_id=823908 Originator: NO Since _wfopen() isn't an ANSI function, (this much is clear, from the uglified name), I'm inclined to say that the guarded prototype in wchar.h is correct. Presumably the intent is to use -ansi, -Wstrict-prototypes and -Wmissing-prototypes, to catch use of non-standard functions in user code, and this can't work if the prototypes for any non-standard functions are declared unconditionally. (Thus, in theory, *all* non-standard function prototypes should be within such a guard, when declared in system headers). However: $ cat foo.c #include <stdio.h> int main() { FILE *null = _wfopen( L"nul", L"wb" ); return 0; } $ gcc -c -Wstrict-prototypes -Wmissing-prototypes foo.c foo.c:4: warning: function declaration isn't a prototype suggests that the prototype in question *isn't* exposed by stdio.h, even *without* -ansi; indeed, it *is* guarded, not by !__STRICT_ANSI__ but by __MSVCRT__, (as it also is in wchar.h), so the argument seems rather moot, for MinGW, since if you want strict ANSI standards conformance you wouldn't be defining __MSVCRT__. To me, it seems no big deal either way, but if the two are made consistent, I've no complaint. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=102435&aid=1815861&group_id=2435 |