:: Re: [DNG] C string handling
Top Page
Delete this message
Reply to this message
Author: Rainer Weikusat
Date:  
To: dng
Subject: Re: [DNG] C string handling
Steve Litt <slitt@???> writes:

> On Sun, 23 Aug 2015 11:37:26 +0100
> Edward Bartolo <edbarx@???> wrote:
>
>> My 'irrational' choice of C language for backend.
>>
>> As a coder, I lack knowledge and experience. This is plain clear from
>> the code I can write, but I offered my very limited coding
>> capabilities to help, notwithstanding I knew, I would have been a
>> dwarf among giants.
>
> Your code was fine Edward. You used a few strcpy() instead of
> strncpy(). Big deal --- it's less than an hour's work to fix it.


There's nothing wrong with using strcpy. But it can't be used with a
fixed size buffer whose size fell from the sky in order to copy some
data of an a priori unknown length. And the fix for that is not "use
strncpy" but "implement proper buffer handling". That's not really
difficult and the easiest way is to do it from the start instead writing
a lot of code which will then have to be changed later.

[...]

> You know who I think is the giant? The guy who actually writes the code
> to do the job. The guys who find the mistakes are essential, but
> they're supporting actors: The star is the guy who writes the code to
> solve the problem.


If you feel entitled to sort people volunteering their time into "worthy
ones" and "less worthy ones", you should perhaps consider that
understanding code written by someone else is more work than writing the
code --- that's why "OMG! Need to rewrite all of this!!" is so immensely
popular: It's much easier.