home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / relnotes / c++_eoe / ch4.z / ch4
Encoding:
Text File  |  2002-10-08  |  16.7 KB  |  659 lines

  1.  
  2.  
  3.  
  4.                                      - 1 -
  5.  
  6.  
  7.  
  8.           7.3.1.3m C++ Compiler Execution Environment Release Notes
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.                                      - 2 -
  66.  
  67.  
  68.  
  69.           4.  _N_e_w__F_e_a_t_u_r_e_s
  70.  
  71.  
  72.  
  73.           4.1  _N_e_w__F_e_a_t_u_r_e_s__i_n__M_I_P_S_p_r_o__7_._3_._1_._3_m
  74.  
  75.           This section lists the new C++ features for the MIPSpro
  76.           7.3.1.3m release.
  77.  
  78.  
  79.           4.1.1  _O_p_t_i_o_n__t_o__d_i_s_a_b_l_e__p_r_e_l_i_n_k_e_r__o_u_t_p_u_t   A new flag,
  80.           -quiet_prelink has been added which when added to the
  81.           compilation command line will disable output of standard
  82.           prelinker messages. This fixes bug #786921.
  83.  
  84.  
  85.  
  86.           4.1.2  _E_x_p_e_r_i_m_e_n_t_a_l__v_e_r_s_i_o_n__o_f__n_e_w__F_r_o_n_t_-_E_n_d   A new
  87.           experimental version of the C++ front-end based on EDG
  88.           version 2.45 and packaged as /usr/lib32/cmplrs/fecc_245 will
  89.           be invoked when -Zf,_245 is added to the compilation command
  90.           line. The new front-end supplies more ANSI/ISO compliant
  91.           features.
  92.  
  93.  
  94.  
  95.           4.1.3  _E_x_p_e_r_i_m_e_n_t_a_l__v_e_r_s_i_o_n_s__o_f__l_i_b_C_i_o___p_t_h_r_e_a_d_s_._a   New
  96.           experimental versions of libCio.a are being provided for use
  97.           when compiling with the -D_PTHREADS attribute.  There are
  98.           n32 and 64-bit versions called /usr/lib32/libCio_pthreads.a
  99.           and /usr/lib64/libCio_pthreads.a.  To link with them you
  100.           must explicitly refer to them on the compilation or linkage
  101.           command line.
  102.  
  103.  
  104.  
  105.  
  106.           4.2  _N_e_w__F_e_a_t_u_r_e_s__i_n__M_I_P_S_p_r_o__7_._3
  107.  
  108.           This section lists the new C++ features for the MIPSpro 7.3
  109.           release.
  110.  
  111.  
  112.  
  113.           4.2.1  _T_e_m_p_l_a_t_e_-_R_e_l_a_t_e_d__f_e_a_t_u_r_e_s  New C++ template-related
  114.           features are described in the following sections.
  115.  
  116.  
  117.           4.2.1.1  _O_v_e_r_l_o_a_d_e_d__F_u_n_c_t_i_o_n__T_e_m_p_l_a_t_e_s
  118.  
  119.           The 2.38 front end now permits you to overload a function
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.                                      - 3 -
  132.  
  133.  
  134.  
  135.           template, as in the following example.
  136.  
  137.           template <class T> void f(T t);           (1)
  138.           template <class X> void f(X p*);          (2)
  139.  
  140.           When you call an overloaded function template, the compiler
  141.           selects the most specific version that matches the argument.
  142.           If the function f is overloaded as in the previous example,
  143.           the compiler selects version (1) when you write f(10) and it
  144.           selects version (2) when you write f((double*) 0). (Previous
  145.           versions of the compiler would issue an error in this case.)
  146.  
  147.           The C++ standard refers to this feature as "partial ordering
  148.           of function templates."  It is sometimes also called
  149.           "partial specialization of functions."
  150.  
  151.  
  152.           4.2.1.2  _E_x_p_l_i_c_i_t _S_p_e_c_i_f_i_c_a_t_i_o_n _o_f _F_u_n_c_t_i_o_n _T_e_m_p_l_a_t_e
  153.           _A_r_g_u_m_e_n_t_s
  154.  
  155.           The usual way of calling a function template is the same as
  156.           calling an ordinary function.  If you write f(10), for
  157.           example, the compiler deduces the types of the template
  158.           parameters.  It is now also possible to specify the template
  159.           arguments explicitly, as in f<int>(10).
  160.  
  161.           This feature makes it possible to write function templates
  162.           whose template arguments cannot be deduced.  For example:
  163.  
  164.           template <class T>
  165.           inline T* null_pointer() { return (T*) 0; }
  166.  
  167.           It is impossible for the compiler to deduce the type of the
  168.           template argument of null_pointer from the function's
  169.           arguments because the function takes no arguments.  You must
  170.           explicitly provide the template arguments when you call this
  171.           function, as in the following example:
  172.  
  173.           null_pointer<X>().
  174.  
  175.           Previous versions of the compiler did not permit function
  176.           templates with template arguments that could not be deduced.
  177.  
  178.  
  179.           4.2.1.3  _U_n_n_a_m_e_d__T_e_m_p_l_a_t_e__P_a_r_a_m_e_t_e_r_s
  180.  
  181.           Unnamed template parameters are now legal, as in the
  182.           following example:
  183.  
  184.           template <class,int> struct A {};
  185.           A<char,1> a1;
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.                                      - 4 -
  198.  
  199.  
  200.  
  201.           4.2.1.4  _N_e_w__S_y_n_t_a_x__f_o_r__R_e_f_e_r_r_i_n_g__t_o__T_e_m_p_l_a_t_e__M_e_m_b_e_r_s
  202.  
  203.           The C++ standard allows (and in some cases requires) a new
  204.           syntax for referring to a member template of a class.  If a
  205.           class A has a member template B<T>, you can write
  206.           A::template B<T>, or a.template B<T>, or pa->template B<T>.
  207.  
  208.           Example:
  209.  
  210.           struct X {
  211.             template <class T> struct Y;
  212.             template <class T> void f();
  213.             template <class T> void g(T);
  214.           };
  215.  
  216.           X x;
  217.           X::template Y<int> y;
  218.           x.template f<int>();
  219.           x.g(10);           // No "template" keyword here, because we are
  220.                              // not providing g's template argument list.
  221.  
  222.  
  223.           In this example, the new syntax is not required.  It is
  224.           required in only one specific case: when you are referring
  225.           to a member template of a class that itself depends on a
  226.           template parameter.
  227.  
  228.           Example:
  229.  
  230.           template <class T>
  231.           void f(T t) {
  232.             T::template Y<int> y;
  233.             ...
  234.           }
  235.  
  236.           The new syntax is required in this case because the compiler
  237.           must be able to interpret "<" as the beginning of a template
  238.           argument list or as a less-than operator.
  239.  
  240.           (Previous releases of the compiler neither required nor
  241.           allowed the new syntax.  This release allows it but does not
  242.           require it.  Future releases might require it.)
  243.  
  244.  
  245.  
  246.           4.2.2  _N_e_w__C_o_m_p_i_l_e_r__C_o_m_m_a_n_d__L_i_n_e__O_p_t_i_o_n_s  The following
  247.           sections describe new compiler options for C++.
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.                                      - 5 -
  264.  
  265.  
  266.  
  267.           4.2.2.1  _I_n_t_e_r_p_r_o_c_e_d_u_r_a_l__P_a_r_a_l_l_e_l_i_z_a_t_i_o_n
  268.  
  269.           The -ipa option invokes the Interprocedural Analyzer option
  270.           group. This is a new alias for -IPA:=ON.  Compiling with the
  271.           -ipa and -pfa options together instructs the compiler to
  272.           perform interprocedural parallelization.  The compiler
  273.           applies a sophisticated analysis to determine when it can
  274.           parallelize loops with calls.
  275.  
  276.  
  277.           4.2.2.2  _L_i_s_t_i_n_g__C_o_n_t_r_o_l
  278.  
  279.           The -clist option invokes the listing control group.  This
  280.           is equivalent to -CLIST:=ON.
  281.  
  282.           The emit_omp=_f_l_a_g suboption to the -CLIST option directs the
  283.           compiler to use OpenMP directives (_f_l_a_g=ON) or MIPS(TM)
  284.           multiprocessing directives (_f_l_a_g=OFF).
  285.  
  286.  
  287.  
  288.           4.2.2.3  _M_e_m_o_r_y__L_o_c_a_t_i_o_n
  289.  
  290.           The speculative_ptr_deref={ON/OFF} suboption to the -OPT
  291.           compiler option allows speculative loads of memory locations
  292.           that differ by a small offset from some referenced memory
  293.           location.  For more information, see the opt(5) man page.
  294.  
  295.  
  296.           4.2.2.4  _P_a_r_a_l_l_e_l_i_z_a_t_i_o_n__A_n_a_l_y_s_i_s
  297.  
  298.           The -LNO:pure={_f_l_a_g} option tells the compiler how to use
  299.           the "no side effects" and "pure" pragmas when gathering
  300.           information about calls for parallelization analysis.
  301.  
  302.  
  303.           4.2.2.5  _T_a_r_g_e_t__O_p_t_i_o_n__G_r_o_u_p__C_o_n_t_r_o_l_s
  304.  
  305.           The target option group has the following new controls:
  306.  
  307.           dismiss_mem_faults=_f_l_a_g  Forces the kernel to dismiss memory
  308.                                    faults that occur during execution.
  309.  
  310.           exc_max=_v_a_l_u_e            Specifies the maximum set of IEEE-
  311.                                    754 floating point exceptions for
  312.                                    which traps can be enabled at run
  313.                                    time.
  314.  
  315.           exc_min=_v_a_l_u_e            Specifies the minimum set of IEEE-
  316.                                    754 floating point exceptions for
  317.                                    which traps must be enabled at run
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.                                      - 6 -
  330.  
  331.  
  332.  
  333.                                    time.
  334.  
  335.           isa=_v_a_l_u_e                Identifies the target instruction
  336.                                    set architecture for compilation.
  337.  
  338.           sync=_f_l_a_g                Enables or disables the use of SYNC
  339.                                    instructions.
  340.  
  341.  
  342.           4.2.2.6  _-_T_E_N_V__S_u_b_o_p_t_i_o_n
  343.  
  344.           The large_got=ON/OFF suboption to the -TENV compiler option
  345.           replaces the -avoid_gp_overflow and the -xgot options.
  346.  
  347.  
  348.  
  349.           4.2.3  _O_t_h_e_r__N_e_w__F_e_a_t_u_r_e_s  The following sections describe
  350.           other new C++ features.
  351.  
  352.  
  353.           4.2.3.1  _C_-_C_a_l_l_a_b_l_e__R_o_u_t_i_n_e_s
  354.  
  355.           C-callable versions of POPCNT, POPPAR, LEADZ, and MASK are
  356.           now available.
  357.  
  358.  
  359.           4.2.3.2  _C_o_v_a_r_i_a_n_t__R_e_t_u_r_n__T_y_p_e_s
  360.  
  361.           Usually, when a derived class overrides a base class's
  362.           virtual member function, the function in the derived class
  363.           must have exactly the same signature as in the base class.
  364.           There is, however, one small exception.
  365.  
  366.           If a virtual function in a base class returns a pointer (or
  367.           reference) to a class X, the overriding virtual function can
  368.           return a pointer to X or to some other class that inherits
  369.           from X.
  370.  
  371.           Example:
  372.  
  373.           struct X {
  374.             virtual ~X() {}
  375.             virtual X* clone() const { return new X(*this); }
  376.           };
  377.  
  378.           struct Y : public X {
  379.             virtual Y* clone() const { return new Y(*this); }
  380.           };
  381.  
  382.           Previous compiler releases did not permit covariant return
  383.           types.  They required a virtual member function in a derived
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.                                      - 7 -
  396.  
  397.  
  398.  
  399.           class to have exactly the same return type as in the base
  400.           class.
  401.  
  402.  
  403.           4.2.3.3  _L_o_o_k_u_p _R_u_l_e_s _f_o_r _M_e_m_b_e_r _R_e_f_e_r_e_n_c_e_s _o_f _t_h_e _F_o_r_m
  404.           _x._A::_B _a_n_d _p->_A::_B
  405.  
  406.           In a class member access expression like x.A::i or p->A::i,
  407.           the class reference (in this case A) is looked up both in
  408.           the context of the expression and in the context of the left
  409.           operand of the "." or "->" operator (in this case, the class
  410.           of which x is a member).  Formerly, the class reference was
  411.           looked up only in the first context, as in the following
  412.           example:
  413.  
  414.           struct A {
  415.             typedef A B;
  416.             int i;
  417.           };
  418.  
  419.           int main() {
  420.             A a;
  421.             a.B:: i = 1; // not previously allowed
  422.           }
  423.  
  424.  
  425.  
  426.           4.2.3.4  _N_e_w__#_p_r_a_g_m_a
  427.  
  428.           The unknown_control_flow (_f_u_n_c_1 [, _f_u_n_c_2 ...]) #pragma
  429.           indicates that the procedures listed as _f_u_n_c_1 and _f_u_n_c_2,
  430.           etc. have a nonstandard control flow behavior.
  431.  
  432.  
  433.  
  434.           4.2.3.5  _O_p_e_n_M_P__D_i_r_e_c_t_i_v_e_s__f_o_r__S_h_a_r_e_d__M_e_m_o_r_y__M_u_l_t_i_p_r_o_c_e_s_s_i_n_g
  435.  
  436.            OpenMP directives are based on the OpenMP C/C++ application
  437.           programming interface (API) standard.  Programs that use
  438.           these directives are portable and can be compiled by other
  439.           compilers that support the OpenMP standard.
  440.  
  441.           To enable recognition of the OpenMP directives, specify -mp
  442.           on the cc or CC command line.  Details of these directives
  443.           are documented in the _M_I_P_S_p_r_o _C _a_n_d _C++ _P_r_a_g_m_a_s manual.
  444.  
  445.  
  446.  
  447.           4.2.3.6  _O_v_e_r_l_o_a_d_i_n_g__o_n__E_n_u_m_e_r_a_t_i_o_n_s
  448.  
  449.           You cannot overload an operator if all of its arguments are
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.  
  460.  
  461.                                      - 8 -
  462.  
  463.  
  464.  
  465.           built-in types, but you can overload it if at least one
  466.           argument is a class or enumeration type.
  467.  
  468.           Example:
  469.  
  470.           enum E {a, b, c, error};
  471.  
  472.           E operator++ (E e) {
  473.             switch(e) {
  474.             case a:
  475.               return b;
  476.             case b:
  477.               return c;
  478.             case c:
  479.               return a;
  480.             default:
  481.               return error;
  482.             }
  483.           }
  484.  
  485.           Previous compiler releases did not allow overloaded
  486.           operators all of whose arguments were enumeration types.
  487.  
  488.  
  489.  
  490.           4.2.3.7  _S_t_a_n_d_a_r_d__C_+_+__L_i_b_r_a_r_y
  491.  
  492.           A standard C++ library is now available.  This library
  493.           includes a standard-conforming I/O library, which has new
  494.           header names. For example, the old iostream.h header is now
  495.           iostream. The functionality for this feature is provided in
  496.           libCio.so, which is provided for n32- and 64-bit ABIs. Using
  497.           the new library requires including the -LANG:std option on
  498.           the command line.  The -LANG:std option also triggers the
  499.           following ISO/ANSI standard-conforming behavior:
  500.  
  501.              +o A user-defined assignment operator for class X is a
  502.                nonstatic nontemplate operator= with a single parameter
  503.                of one of the following types:
  504.  
  505.                X
  506.                X&
  507.                const X&
  508.                volatile X&
  509.                const volatile X&
  510.  
  511.                A template operator= or an operator= with a different
  512.                type (even if the type is derived from X) is not
  513.                considered to be an assignment operator, and does not
  514.                prevent the compiler from generating an implicit
  515.                operator=.
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526.  
  527.                                      - 9 -
  528.  
  529.  
  530.  
  531.              +o The typename keyword cannot be omitted where the
  532.                standard mandates it.
  533.  
  534.              +o The scope of a variable declared in the initialization
  535.                of a for-loop is the for-loop and not the surrounding
  536.                scope.
  537.  
  538.              +o Guiding declarations are not allowed.
  539.  
  540.              +o Old-style template specializations are not allowed.
  541.                The new template syntax is now required for complete
  542.                specializations.
  543.  
  544.              +o When you use -LANG:std, there is no longer an implicit
  545.                conversion from function pointer types to void*.
  546.                However, it is still possible to do the conversion with
  547.                a cast.
  548.  
  549.              +o When you use -LANG:std, operator new throws a bad_alloc
  550.                exception to signal out of memory, rather than
  551.                returning a null pointer.
  552.  
  553.              +o The overload resolution rules are now stricter in the
  554.                sense that some old tie-breaker rules have been
  555.                abolished.  The effect of this is that some function
  556.                calls that were resolved by these discarded rules are
  557.                now ambiguous.  For example, consider the following
  558.                code:
  559.  
  560.                struct X {
  561.                  X(int);
  562.                };
  563.  
  564.                void f(int, const int *);
  565.                void f(X, int *);
  566.  
  567.  
  568.                int main()
  569.                {
  570.                  int *p;
  571.                  f(1, p);
  572.                }
  573.  
  574.                If -LANG:std is specified, the call to f(1, p) becomes
  575.                ambiguous.  Because f(int, const int*) is preferred for
  576.                the first argument but f(X, int *) is preferred for the
  577.                second, no attempt is made to reconsider and break the
  578.                tie.
  579.  
  580.              +o The _STANDARD_C_PLUS_PLUS macro is defined.
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591.  
  592.  
  593.                                      - 10 -
  594.  
  595.  
  596.  
  597.           4.2.3.8  _S_u_p_e_r_c_o_m_p_u_t_i_n_g__A_P_I__S_u_p_p_o_r_t
  598.  
  599.           The MIPSpro 7.3 release supports the Supercomputing
  600.           Application Programming Interface (API), a set of language
  601.           features and library functions that are implemented across
  602.           the Silicon Graphics and Cray(TM) product line to meet the
  603.           application portability needs of high-performance, technical
  604.           computing customers.
  605.  
  606.  
  607.  
  608.  
  609.  
  610.  
  611.  
  612.  
  613.  
  614.  
  615.  
  616.  
  617.  
  618.  
  619.  
  620.  
  621.  
  622.  
  623.  
  624.  
  625.  
  626.  
  627.  
  628.  
  629.  
  630.  
  631.  
  632.  
  633.  
  634.  
  635.  
  636.  
  637.  
  638.  
  639.  
  640.  
  641.  
  642.  
  643.  
  644.  
  645.  
  646.  
  647.  
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654.  
  655.  
  656.