My simulation aborts with the error message: List position (x) is out-of-range. What does the error message mean?

Categories:
Solution Number:
S20602
Last Modified:
2013-08-20
Issue

My simulation aborts with the error message: List position (x) is out-of-range. What does the error message mean?

Solution

OPNET's list package indexes list elements starting at zero similar to the array indexing scheme defined by C. This means that if there are N elements in a list (created using the op_prg_list package), then the valid values for the second argument of op_prg_list_access i.e. pos_index, range from zero through N - 1. As good programming practice, it is recommended that you use the op_prg_list_size Kernel Procedure(KP) to determine the number of elements in a list before using op_prg_list_access to access elements in the list. An example scenario is shown below:list_size = op_prg_list_size (your_list_ptr);for (i = 0; i < list_size; i++) { list_elem_ptr = (list_elem_datatype *) op_prg_list_access (your_list_ptr, i); /* ...the rest of your code here. */} For detailed information on OPNET list related API please refer to Online documentation->Simulation Kernel->Programming(Prg) Package.

Environment

DES Kernel->Other,Logs and Errors

Attachments
NOTICE: Riverbed® product names have changed. Please refer to the Product List for a complete list of product names.
Can't find an answer? Create a case