#!/bin/sh
#
GTK_IM_MODULE=scim-bridge
...
Then, Adobe Reader launches normally!
I am a software developer working in Hong Kong. This blog is for sharing my 2 cents IT knowledge.
#!/bin/sh
#
GTK_IM_MODULE=scim-bridge
...
char charArray[4]={'a','b','c',0,};Use the following lines to print out the contents of str1 and str2:
string str1(charArray);
string str2;
str2.append(charArray, 4);
cout << "str1 [" << str1 << ']' << endl;The output would be:
cout << "str2 [" << str2 << ']' << endl;
str1 [abc]Two strings looks same. However, does str1 equal to str2?
str2 [abc]
cout << (str1 == str2? "equal" : "not equal") << endl;The output:
not equalWhy not!? Let's print out the size of the strings:
cout << "str1 size = " << str1.size() << endl;The output:
cout << "str2 size = " << str2.size() << endl;
str1 size = 3In short, we should be careful about the == operator of strings. It does not only compare the contents of strings, but it also compares the size of strings.
str2 size = 4
mutex.lock();Increment an integer just takes one CPU instruction, but locking and unlocking of mutex takes hundreds or thousands of CPU instructions. To avoid race condition, we can use atomic operations provided by CPU. Referring to /usr/include/asm-i386, there is implementation of atomic add:
count++;
mutex.unlock();
static __inline__ void atomic_add(int i, atomic_t *v)In Apache Portable Runtime project, it provides a set of atomic operations for different platforms.
{
__asm__ __volatile__(
LOCK_PREFIX "addl %1,%0"
:"=m" (v->counter)
:"ir" (i), "m" (v->counter));
}