3 ms·
Yes, you're right, tag_union does throw a compile time error, I didn't read that correctly. By your earlier comment I was primed for a `_Static_assert` and when
by klodolph 9y ago
Yes, you're right, tag_union does throw a compile time error, I didn't read that correctly. By your earlier comment I was primed for a `_Static_assert` and when I didn't see that. I thought it had been left out entirely rather than reimplemented in a different manner.
On the subject of tone--I honestly believe that the original code has severe subjective design flaws and objective implementation errors, and since the post was gathering upvotes but no critique I was worried that people believed that the code was correct. There are still some nitpicks about your new version, but these are fairly minor in my view (the use of reserved identifiers is pretty tedious and easily avoided). The remaining non-nitpick, what I consider to be a show-stopper, is that you can't switch on the tag. 90% of the time when I'm using a tagged union, I'm doing switch (evt->type). While we can substitute a chain of if/else, I'm not fond of the ergonomics and I would prefer a traditional enum. This is a subjective trade-off, however.
Your responses would have been fine if they were criticisms of my argument or of the tone I took. Perhaps I crossed the line, and you called me on it? But these comments are unacceptable ad hominems:
> Oh, the horror. It's C, a language that generally expects you to know what you are doing.
> Wit beyond measure, fascinating.