In the following program, this line
_tprintf(_T("'%s'\n"), _tcsrev(str));
crashes the .exe compiled with Pelles C 64 on Vista x64.
Compiler command line is
pocc -W1 -Go -Gr -Ze -Zx -Tamd64-coff gentext.c
and the command line for the linker is
polink -release -machine:x64 -subsystem:console -OUT:gentext.exe gentext.obj
Robert Wishlaw
// gentext.c
// use of generic-text mappings defined in tchar.h
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <direct.h>
#include <errno.h>
#include <tchar.h>
int __cdecl _tmain(int argc, _TCHAR **argv, _TCHAR **envp)
{
_TCHAR buff[260];
_TCHAR *str = _T("Astring");
char *amsg = "Reversed";
wchar_t *wmsg = L"Is";
#ifdef _UNICODE
printf("Unicode version\n");
#else /* _UNICODE */
#ifdef _MBCS
printf("MBCS version\n");
#else
printf("SBCS version\n");
#endif
#endif /* _UNICODE */
if (_tgetcwd(buff, 260) == NULL)
printf("Can't Get Current Directory - errno=%d\n", errno);
else
_tprintf(_T("Current Directory is '%s'\n"), buff);
_tprintf(_T("'%s' %hs %ls:\n"), str, amsg, wmsg);
_tprintf(_T("'%s'\n"), _tcsrev(str));
return 0;
}