Ticket #24 (seen Problem)

Opened 3 years ago

Last modified 3 years ago

inconsistent behavior with respect to out-of-range vector references

Reported by: vern Owned by:
Priority: Normal Milestone:
Component: Bro Version:
Keywords: Cc:

Description

[from Matthias & Christian]

This:

global foo: vector of count = { 42 };

print foo[0];
print foo[1];
print foo[2];

just prints 42 (index 1), with no warning that 0 and 2 don't exist. But this:

  global foo: vector of count = { 42 };
  global f0: count;
  global f1: count;
  global f2: count;

  f0 = foo[0]; f1 = foo[1]; f2 = foo[2];

  print f0; print f1; print f2;

yields

... run-time error, value used but not set
42
... run-time error, value used but not set

whereas this:

  global foo: vector of count;
  foo[0] = 42;

yields:

... (foo[0]): error, index (0) must be positive

Change History

comment:1 Changed 3 years ago by robin

  • Status changed from new to seen
Note: See TracTickets for help on using tickets.