On Wednesday 30 March 2016 17:18:48 Fons Adriaensen wrote:
> On Wed, Mar 30, 2016 at 03:47:08PM -0400, Gene Heskett wrote:
> > Phew! I'm with you 100% Fons. Stay upwind, way upwind of code like
> > this.
>
> Normally I do. But this was 1) something I needed, and 2) a challenge.
>
> > For starters, where the heck are the closing } for the two else
> > clauses above?
>
> They are there, somewhere....
>
> Another example. This is what I wrote (a new function):
>
> ----------
> /* Delete a direct dependency of client B on client A.
> */
> static void
> rem_depends (jack_client_internal_t *A, jack_client_internal_t *B)
> {
> jack_feedcounts_t *X, *Y;
>
> for (X = 0, Y = A->feedlist; Y; X = Y, Y = Y->next)
> {
> if (Y->client == B)
> {
> if (X) X->next = Y->next;
> else A->feedlist = Y->next;
> B->depcount--;
> free (Y);
> return;
> }
> }
> }
This 100% readable. And its what I would have written 30 years back when
I was still doing code other than the G-Code I am currently hacking up.
> ----------
>
> And this is what was committed:
>
> ----------
> /* Delete a direct dependency of client B on client A.
> */
> static void
> rem_depends (jack_client_internal_t *A, jack_client_internal_t *B)
> {
> jack_feedcounts_t *X, *Y;
>
> for (X = 0, Y = A->feedlist; Y; X = Y, Y = Y->next) {
> if (Y->client == B) {
> if (X) {
> X->next = Y->next;
> } else { A->feedlist =
> Y->next; } B->depcount--;
> free (Y);
> return;
> }
> }
> }
That should work, but it has that smell in spite of itself.
What has become of the first principle, write READABLE code?
I'll get me coat now. This is a younger persons game, but its not an
improvement...
> Ciao,
Cheers, Gene Heskett
-- "There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed Howdershelt (Author) Genes Web page <http://geneslinuxbox.net:6309/gene> _______________________________________________ Linux-audio-user mailing list Linux-audio-user@email-addr-hidden http://lists.linuxaudio.org/listinfo/linux-audio-userReceived on Thu Mar 31 08:15:02 2016
This archive was generated by hypermail 2.1.8 : Thu Mar 31 2016 - 08:15:02 EEST