Completing C code with D style

forkit forkit at gmail.com
Fri Nov 12 04:13:33 UTC 2021


On Thursday, 11 November 2021 at 19:34:42 UTC, Stanislav Blinov 
wrote:
>
> Original C code from the first post can only fail on I/O, which 
> is arguably out of your control. And the meat of it amounts to 
> 10 conditional stores. Your implementations, in both C and D, 
> are a very, very far distance away from that. Like I mentioned 
> before, the whole algorithm can already complete even before a 
> single `malloc` call starts executing. Not caring about *that* 
> is just bad engineering.

Actually, that's an interesting comment, as it clearly indicates 
where we differ in perspective when we read that initial code.

The 'meat' of it, from my perspective, is 'there's someone using 
this code'.

So why is there no code to verify that input, and handle 
incorrect input in a user friendly manner.

The rest of the coding is kinda automatic reflex.. use a for 
loop.. or a switch..use an array or a vector..separate concerns 
into functions...I really don't care what or how you do that part 
(as long as it's not code I need to understand or maintain).

But don't give me a program that says enter a, b or c, but 
ultimately doesn't give a shi# what I enter.

Hence the 'addition's I made ;-)

I think your perspective, and mine (and others) are ALL valid.



More information about the Digitalmars-d-learn mailing list