發表文章

目前顯示的是 7月, 2014的文章

indirect function (IFUNC)

function attribute: This allows the resolution of the symbol value to be determined dynamically  at load time , and an optimized version of the routine can be selected for the particular processor or other system characteristics determined then. NOTE:  require a recent binutils (at least version 2.20.1), and GNU C library (at least version 2.11.1). ps. building arm static binary with using ld.gold linker has bug https://sourceware.org/bugzilla/show_bug.cgi?id=17081 https://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html https://gcc.gnu.org/ml/gcc-help/2012-03/msg00209.html Real example: glibc for armv7 has 3 type memcpy implementation. __memcpy_neon __memcpy_vfp memcpy_arm memcpy (IFUNC):   if (neon supported)      return &__memcpy_neon   if (vfp supported)      return &__memcpy_vfp   return &__memcpy_arm memcpy will choose memcpy implementation at load time memcpy use HWCP info (include ...

lvalue & rvalue

reference: http://www.cprogramming.com/c++11/rvalue-references-and-move-semantics-in-c++11.html http://en.cppreference.com/w/cpp/language/value_category An lvalue is an expression whose address can be taken  You can make assignments to lvalues 1 2 3 4 5 6 7 int x; int & getRef () {          return x; } getRef() = 4; A Rvalue is a temporary value. You can't make assignments to lvalues 1 2 3 4 5 string getName () {      return "Alex" ; } getName(); C++11  rvalue reference let you bind a mutable reference to an rvalue Rvalue references use the && syntax instead of just &, and can be const and non-const 1 2 const string&& name = getName(); // ok string&& name = getName(); // also ok - praise be! 1 2 3 4 5 6 7 8 9 printReference ( const String& str) ...