Checking index in vectors is broken

Description

If you try to check an index in a vector for existence, you get an error...

Error:

fatal error in bool: BroType::AsVectorType (bool/vector) (bool)

Environment

None

Activity

Show:
Johanna Amann
October 28, 2014, 2:31 PM

I actually thought about exactly that when I read the bug report - and I am not sure.

Just because the length of a vector is greater than a specific element does not mean that all smaller elements are set at the moment (unless I am very much mistaken).

Jon Siwek
October 28, 2014, 2:50 PM

Just because the length of a vector is greater than a specific element does not mean that all smaller elements are set at the moment (unless I am very much mistaken).

Yeah, I think I remember it working like that also, but not sure if it's actually intended to be used in that way. Probably should be easy to implement the "in" operator so it just checks that. Unless there's some larger functionality Seth wanted?

Jon Siwek
October 28, 2014, 7:32 PM

Fix in topic/jsiwek/bit-1280

Robin Sommer
October 31, 2014, 11:28 PM

Merging.

Generally, I would actually prefer vector elements to be automatically initialized with null values corresponding to the vector's type; then the "in" would always return true. However, we don't have the concept of a type-specific null/default values.

Robin Sommer
November 1, 2014, 1:31 AM

.

Assignee

Robin Sommer

Reporter

Seth Hall

Labels

None

External issue ID

None

Components

Fix versions

Affects versions

Priority

Normal
Configure