Commit a04a9985 authored by thomas.forbriger's avatar thomas.forbriger Committed by thomas.forbriger
Browse files

error messages are clearer to read in examples with short type names

This is a legacy commit from before 2015-03-01.
It may be incomplete as well as inconsistent.
See COPYING.legacy and README.history for details.


SVN Path:     http://gpitrsvn.gpi.uni-karlsruhe.de/repos/TFSoftware/trunk
SVN Revision: 1260
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent 9eed9021
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: f77test.cc,v 1.8 2003-01-03 16:56:49 forbrig Exp $
* $Id: f77test.cc,v 1.9 2003-01-03 17:20:20 forbrig Exp $
* \author Thomas Forbriger
* \date 22/12/2002
*
......@@ -45,7 +45,7 @@
#define AFF_F77TEST_CC_VERSION \
"AFF_F77TEST_CC V1.2"
#define AFF_F77TEST_CC_CVSID \
"$Id: f77test.cc,v 1.8 2003-01-03 16:56:49 forbrig Exp $"
"$Id: f77test.cc,v 1.9 2003-01-03 17:20:20 forbrig Exp $"
#include <aff/array.h>
#include <aff/fortranshape.h>
......@@ -179,30 +179,41 @@ int main()
CODE(double *dp=fv1.castedpointer<double>());
CODE(*dp=35.e12);
CODE(cout << v1(1) << ", " << v2(1) << endl);
section("Test illegal usage:",' ');
CODE(Array<int> iv1(1));
CODE(ConstArray<int> iv2(iv1));
CODE(FortranArray<Array<int> > fiv1(iv1));
CODE(FortranArray<ConstArray<int> > fiv2(iv2));
CODE(iv1(1)=50);
CODE(cout << iv1(1) << ", " << iv2(1) << endl);
CODE(int *iv1p=fiv1.pointer());
CODE(const int *iv2p=fiv2.pointer());
CODE(cout << *iv1p << ", " << *iv2p << endl);
#ifdef ILLEGAL1
#warning intentionally compiling illegal code:
#warning direct discard of const qualifier in conversion from non-const
CODE(Ticvalue *ip1=fv1.castedpointer<const Ticvalue>());
CODE(int *ip1=fiv1.castedpointer<const int>());
#endif
#ifdef ILLEGAL2
#warning intentionally compiling illegal code:
#warning direct discard of const qualifier in conversion from const array
CODE(Ticvalue *ip2=fv2.castedpointer<const Ticvalue>());
CODE(int *ip2=fiv2.castedpointer<const int>());
#endif
#ifdef ILLEGAL3
#warning intentionally compiling illegal code:
#warning discards const in conversion (reinterpret_cast)
CODE(Ticvalue *ip3=fv2.castedpointer<Ticvalue>());
CODE(int *ip3=fiv2.castedpointer<int>());
#endif
#ifdef ILLEGAL4
#warning intentionally compiling illegal code:
#warning direct type mismatch
CODE(float *ip4=fv1.castedpointer<Ticvalue>());
CODE(float *ip4=fiv1.castedpointer<int>());
#endif
#ifdef ILLEGAL5
#warning intentionally compiling illegal code:
#warning wrong type size in conversion through reinterpret_cast
CODE(float *ip5=fv1.castedpointer<float>());
CODE(double *ip5=fiv1.castedpointer<double>());
#endif
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment