To successfully compile the code with either compiler, use one of the two alternatives shown below:
void f(const int &); // Use a constant reference. int main () {
f(3); return 0;
}
Or
void f(int &); int i;
int main () { i=3;
f(i);// Use an lvalue for reference initialization. return 0;
}
Digraph White Space Separators
HP C++ does not support alternative tokens (digraphs). In HP aC++, digraphs are supported and legal C++ syntax can be considered an error because of digraph substitution. Insert a blank between two characters of the digraph.
Example:
C<::A> a;
The characters <: are one of the alternative tokens (digraphs) for which HP aC++ performs a
substitution. In this case, <: becomes [. The statement to be compiled becomes C[:A a;, which produces many compilation errors.
To successfully compile this program with either compiler, insert a blank between < and :.
Example:
C< ::A> a;
Migration Considerations when Using Templates
In HP aC++, templates are processed differently than in HP C++ (cfront). HP aC++ does not have a repository. All instantiations are placed in an object (.o) file (with additional information in a
.Ia file if you specify the +inst_auto
See Chapter 5: “Using HP aC++ Templates” (page 132) for more information.
To begin migrating code containing templates to HP aC++, try to compile and link using the default
•The +inst_all option to view all
•The +inst_directed option to mask
To reset after all translation units compile successfully:
1.Remove any .o and .I files. Using a clobber makefile target to remove .I files is similar to removing the ptrepository directory in cfront.
2.Recompile and link using
Verbose Template Processing Information
Use the +inst v option to replace the cfront
Migration Considerations when Using Templates 219