I had thought of a solution like this as well, but this is an execution time exception. C++ allows you to have a compile time exception.
A simplified example of my situation: several arrays that are all equal in lenght and at certain point in the code you need to show the values in several labels.
changing length to 2 would cause an error at runtime for label3. C++ allows you to prevent this with a compiler error.Code:const int length = 3; int[] array1 = int[length]; int[] array2 = int[length]; int[] array3 = int[length]; for(int i=0; i < length; i++) { ... } label1.Text = array1[0].ToString(); label2.Text = array1[1].ToString(); label3.Text = array1[2].ToString();
regards,
Jef




Reply With Quote