1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

cgen: implement >= and <= (#7991)

This commit is contained in:
Swastik Baranwal
2021-01-10 15:54:46 +05:30
committed by GitHub
parent 73bd63d69d
commit 1f5255c2bb
11 changed files with 49 additions and 9 deletions

View File

@ -3217,11 +3217,11 @@ operator overloading is an important feature to have in order to improve readabi
To improve safety and maintainability, operator overloading is limited:
- It's only possible to overload `+, -, *, /, %, <, >, ==, !=` operators.
- It's only possible to overload `+, -, *, /, %, <, >, ==, !=, <=, >=` operators.
- `==` and `!=` are self generated by the compiler but can be overriden.
- Calling other functions inside operator functions is not allowed.
- Operator functions can't modify their arguments.
- When using `<`, `>`, `==` and `!=` operators, the return type must be `bool`.
- When using `<`, `>`, `>=`, `<=`, `==` and `!=` operators, the return type must be `bool`.
- Both arguments must have the same type (just like with all operators in V).
## Inline assembly