Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

locale problems with Studio 8 + stlport4

807575Feb 15 2005 — edited Feb 18 2005
Hi,

I'm on Solaris 9 (sparc) with Studio 8 compiler and stlport4. I have latest compiler patches 112763-17 & 113817-10.

Using the stlport4 version of the constructor std::locale(const char * name), I can only construct C locale - any other locale name throws, even if valid.

Using the standard library works for all installed locales.

Here's a file "loctest.cc" than I have compiled with Studio 8 both with and without stlport4 (also with g++ for comparison):
#include <iostream>
#include <locale>

using namespace std;

int
main(int argc, char **argv)
{
    for (int ii = 1; ii < argc; ++ii) {
	try {
	    locale loc(argv[ii]);
	    cout << "Created locale " << loc.name() << endl;
	}

	catch (exception & e) {
	    cout << "Error for " << argv[ii] << ": " << e.what() << endl;
	}
    }

    return 0;
}
Makefile:
loctest.gnu: loctest.cc
	g++ -g -I. loctest.cc -o loctest.gnu

loctest.sun: loctest.cc
	CC -g -I. loctest.cc -o loctest.sun

loctest.stlport: loctest.cc
	CC -g -I. -mt -library=stlport4 -staticlib=stlport4 \
	loctest.cc -o loctest.stlport
The GNU compiler accepts anything (no zh locale on the test system):

$ loctest.gnu C en_AU zh
Created locale C
Created locale en_AU
Created locale zh

Studio 8 with standard library is better as it rejects uninstalled locales:

$ loctest.sun C en_AU zh
Created locale C
Created locale en_AU
Error for zh: System does not recognize this locale name

Studio 8 with stlport4, which I need to use at the moment, only constructs for "C":

$ loctest.stlport C en_AU zh
Created locale C
Error for en_AU: locale error
Error for zh: locale error

Am I doing something wrong? Or does anyone know of a workaround if this is a known problem?

Regards
Steve
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 18 2005
Added on Feb 15 2005
2 comments
128 views