Skip to content

Can't compile boundaries #511

@jorgesg82

Description

@jorgesg82

There was a warning that advises you that maybe you are messing up with concatenated conditions without parenthesis, and that is precisely what is going on with boundaries. In fact, the compiler is right and it is evaluating badly. Is on line 260 aprox on Boundary.hpp file.
The code below is the problematic one:

Protections::FaultType check_bounds()override{
if(*src < lower_boundary || *src > upper_boundary) return Protections::FAULT;
	if(has_warning_level && *src < lower_boundary || *src > upper_boundary){
		return Protections::WARNING;
	}
	return Protections::OK;
}

It can be fixed this way:

Protections::FaultType check_bounds()override{
	if(has_warning_level && (*src < lower_boundary || *src > upper_boundary)){
		return Protections::WARNING;
	}
	if(*src < lower_boundary || *src > upper_boundary) return Protections::FAULT;
	return Protections::OK;
}

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions