2012/10/19 Ozkan Sezer <[email protected]>
> On Fri, Oct 19, 2012 at 2:00 AM, Roger Pack <[email protected]> wrote:
> >> Something is messing with the defines in your code, it works fine when I
> >> tested.
> >>
> >> $ x86_64-w64-mingw32-gcc -E
> >> mingw-w64/trunk/mingw-w64-headers/crt/intrin.h | grep wcslen
> >> size_t __attribute__((__cdecl__)) wcslen(const wchar_t *);
> >>
> >> $ x86_64-w64-mingw32-gcc -E
> >> mingw-w64/trunk/mingw-w64-headers/crt/wchar.h | grep wcslen
> >> size_t __attribute__((__cdecl__)) wcslen(const wchar_t *_Str);
> >
> > It appears that there is a
> > #define const
> > before a
> > #include <windows.h>
>
> I get wcslen always with const params:
>
> $ x86_64-w64-mingw32-gcc -E
> cross_win64/x86_64-w64-mingw32/include/winnt.h | grep wcslen
> size_t __attribute__((__cdecl__)) wcslen(const wchar_t *_Str);
> size_t __attribute__((__cdecl__)) wcslen(const wchar_t *);
>
> $ i686-w64-mingw32-gcc -E cross_win32/i686-w64-mingw32/include/winnt.h
> | grep wcslen
> size_t __attribute__((__cdecl__)) wcslen(const wchar_t *_Str);
>
> $ i686-w64-mingw32-gcc -E
> cross_win32/i686-w64-mingw32/include/intrin.h | grep wcslen
> size_t __attribute__((__cdecl__)) wcslen(const wchar_t *);
>
> $ i686-w64-mingw32-gcc -E cross_win32/i686-w64-mingw32/include/wchar.h
> | grep wcslen
> size_t __attribute__((__cdecl__)) wcslen(const wchar_t *_Str);
>
> Who is defining const as an empty macro? That doesn't seem right.
>
C++ only makes it undefined behavior, and the rules are fuzzy at best
(seems that it's only undefined behavior when the translation unit includes
a standard header):
http://stackoverflow.com/questions/2726204/c-preprocessor-define-ing-a-keyword-is-it-standards-conforming
In C, it seems that it is allowed.
All this doesn't change the fact that #define const is incredibly stupid
and should be removed from user code.
Ruben
>
> >
> > in this case.
> >
> > Now why would this fail in x86 but not in w32?
> >
> > Appears that in winnt.h, there is a #include <intrin.h>
> > that is hit in x86 mode but not w32 mode.
> >
> > appears around line 1102'ish is a
> > #if defined(__x86_64)
> >
> > that is making the difference.
> > Is this expected?
> > Thanks!
> > -roger-
>
> --
> O.S.
>
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_sfd2d_oct
> _______________________________________________
> Mingw-w64-public mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
>
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public