Am I evil for this?

cc cc at nevernet.com
Fri Oct 14 19:30:47 UTC 2022


On Friday, 14 October 2022 at 07:54:40 UTC, Atila Neves wrote:
> As Bjarne said once in response to complaints that operator 
> overloading lets people write code that doesn't do what you 
> expect:
>
> ```
> // notice how the code and the docs lie
> /**
>  * Adds two numbers
>  */
> int sum(int i, int j) {
>     return i - j;  // oops
> }
> ```

```
struct APerfectlyHarmlessDefaultZeroInitializedStruct {
	int i;
	long l;
	string s;
	Object o;
	float f; // oops!
}
```


More information about the Digitalmars-d mailing list