Page 1 of 1

More #if for wchar_t cleanliness?

Posted: Fri Apr 02, 2010 4:29 am
by scribe
Hello :) Newbie here. It's not so much a "feature" as more of a coding practice, I suppose, but it's weird enough to bother me so I thought I'd mention this here, just to see what comes out of it.

I can see that OGRE_WCHAR_T_STRINGS isn't fully supported (basically unusable) as there are some occurrences of hardcoded char or "..." strings as opposed to L"...", without #if preprocessor for wchar_t version (notably ogrestring and ogreexception like const char* what() ).

My laptop is naturally in a wide char environment and desktop is narrow char, so I'm used to seeing string errors at compilation time and doing a manual fix, but it's still a bit odd in this day and age (or so some perception may say?). It is a graphics engine so I can see it's not such a priority, but still it's awkward... I searched the forum and some earlier comments on this date back to 2005.

As much as I can see, it's either a question of having wchar_t counterpart to char whenever char is used for strings. Or, not mixing OGRE::String variable with char* in the same method, because OGRE::String defined with wstring will naturally conflict in methods which mix with hardcoded char. So either avoiding using char at all and use OGRE::String instead, or more #if lines? Either way it seems as though the current standard is a bit of a mish-mash.

Please forgive me if there is a fix I've missed somewhere. I'm new to Ogre.