B
Blue
I've been relying on gcc compiling this but now it doesn't so I'm
hoping to learn the right way.
See the header below.
TCHAR Message[] = TEXT("Press a Key to Change Setting...");
this basicly becomes
wchar_t Message[] = ((wchar_t *)L"Press a Key to Change Setting..."));
And now I get the gcc error: initializer fails to determine size of
`Message'
I have tried casting to wchar_t[] but that gives it's own error.
What's the legal way of doing this? Without templates please? And
typedef types rather than #define'd equivelents.
The whole point of my types library is so I don't assume built in
types. For instance a character could be 'unsigned char' or 'unsigned
wchar_t" if I wanted, maybe even 'unsigned int'.
I have after some pruning
***************************************
#ifdef DEFAULT_ASCII
#ifdef DEFAULT_UNICODE
#undef DEFAULT_UNICODE
#endif
#endif
#define ASCII_TEXT(x) ((XTYPE::ACHAR *)(x))
#define UNICODE_TEXT(x) ((XTYPE::UCHAR *)(L##x))
namespace XTYPE
{
typedef char ACHAR ;
typedef wchar_t UCHAR ;
typedef ACHAR * ASTRING ;
typedef CONST ACHAR * CASTRING ;
typedef UCHAR * USTRING ;
typedef CONST UCHAR * CUSTRING ;
#ifdef DEFAULT_ASCII
typedef ACHAR CHAR ;
#define TEXT(x) ASCII_TEXT(x)
typedef CHAR * STRING ;
typedef CONST STRING CSTRING ;
typedef CHAR TCHAR ;
typedef TCHAR * TSTRING ;
typedef CONST TSTRING CTSTRING ;
#endif
#ifdef DEFAULT_UNICODE
typedef UCHAR CHAR ;
#define TEXT(x) UNICODE_TEXT(x)
typedef CHAR * STRING ;
typedef CONST STRING CSTRING ;
typedef CHAR TCHAR ;
typedef TCHAR * TSTRING ;
typedef CONST TSTRING CTSTRING ;
#endif
} ;
hoping to learn the right way.
See the header below.
TCHAR Message[] = TEXT("Press a Key to Change Setting...");
this basicly becomes
wchar_t Message[] = ((wchar_t *)L"Press a Key to Change Setting..."));
And now I get the gcc error: initializer fails to determine size of
`Message'
I have tried casting to wchar_t[] but that gives it's own error.
What's the legal way of doing this? Without templates please? And
typedef types rather than #define'd equivelents.
The whole point of my types library is so I don't assume built in
types. For instance a character could be 'unsigned char' or 'unsigned
wchar_t" if I wanted, maybe even 'unsigned int'.
I have after some pruning
***************************************
#ifdef DEFAULT_ASCII
#ifdef DEFAULT_UNICODE
#undef DEFAULT_UNICODE
#endif
#endif
#define ASCII_TEXT(x) ((XTYPE::ACHAR *)(x))
#define UNICODE_TEXT(x) ((XTYPE::UCHAR *)(L##x))
namespace XTYPE
{
typedef char ACHAR ;
typedef wchar_t UCHAR ;
typedef ACHAR * ASTRING ;
typedef CONST ACHAR * CASTRING ;
typedef UCHAR * USTRING ;
typedef CONST UCHAR * CUSTRING ;
#ifdef DEFAULT_ASCII
typedef ACHAR CHAR ;
#define TEXT(x) ASCII_TEXT(x)
typedef CHAR * STRING ;
typedef CONST STRING CSTRING ;
typedef CHAR TCHAR ;
typedef TCHAR * TSTRING ;
typedef CONST TSTRING CTSTRING ;
#endif
#ifdef DEFAULT_UNICODE
typedef UCHAR CHAR ;
#define TEXT(x) UNICODE_TEXT(x)
typedef CHAR * STRING ;
typedef CONST STRING CSTRING ;
typedef CHAR TCHAR ;
typedef TCHAR * TSTRING ;
typedef CONST TSTRING CTSTRING ;
#endif
} ;