2 ms·
This sounds like a classic case of "simplicity is in the eye of the beholder". If you're someone who has experience with, or can easily grok concepts such as "
by whack 6y ago
This sounds like a classic case of "simplicity is in the eye of the beholder".
If you're someone who has experience with, or can easily grok concepts such as "pointer to a pointer", then the second snippet seems obviously simpler. After all, there are fewer branches to consider.
Unfortunately, as someone who stopped working with pointers a long time ago, my mind has to work in overdrive to understand any implementation that relies on a "pointer to a pointer". Hence why the first implementation is far easier for me to understand.
I'm sure we'll see many debates around which solution is simpler, but these debates will never reach a resolution. Depending on the skills and experiences you bring to the table, different people will objectively benefit from very different implementations.
https://software.rajivprab.com/2019/08/29/abstractions-are-in-the-eye-of-the-beholder/ https://software.rajivprab.com/2019/08/29/abstractions-are-i...