There's (1):

```
// assume x,y are non-negative
if(x > max - y) error;
```

And (2):

```
// assume x,y are non-negative
int sum = x + y;
if(sum < x || sum < y) error;
```

Whichs is preferred or is there a better way.

There's (1):

```
// assume x,y are non-negative
if(x > max - y) error;
```

And (2):

```
// assume x,y are non-negative
int sum = x + y;
if(sum < x || sum < y) error;
```

Whichs is preferred or is there a better way.