C/C++ and Fortran

 View Only



LinkedIn Share on LinkedIn

The XL C/C++ V12.1 compiler supports the "right angle bracket" feature

By Archive User posted Sun May 26, 2013 06:47 AM

  

Originally posted by: RoyHu


 The XL C/C++ V12.1 Compiler introduces the support for the C++11 feature "right angle bracket". This new feature is designed to resolve the following problem:

Problem:
In C++, consecutive right angle brackets (>) must be separated by a whitespace. Otherwise, they are treated as the bitwise right-shift operator (>>).Although this issue is minor, it is an annoyance to many new programmers.


For example, the most common text where consecutive right angle brackets appear is nested template-id.

template <int i> class X {};
template <class T> class Y {};
Y<X<1> > x1; // OK
Y<X<2>> x2;  // Error

Solution:
To resolve this problem, the XL C/C++ Compiler, V12 implements the C++11 feature. When a single left angle bracket is active, the >> token is treated as two right angle brackets rather than right shift-operator.  This feature makes your programming more convenient.

You can use the -qlanglvl=rightanglebracket option to enable this feature.

For details about this feature, you can access the following link:
http://pic.dhe.ibm.com/infocenter/comphelp/v121v141/topic/com.ibm.xlcpp121.aix.doc/language_ref/class_templates.html

 

0 comments
0 views

Permalink