9front - general discussion about 9front
 help / color / mirror / Atom feed
From: Silas McCroskey <inkswinc@gmail.com>
To: "Iruatã Souza" <iru.muzgo@gmail.com>
Cc: 9front@9front.org, ori@eigenstate.org
Subject: Re: [9front] Re: vncv(1): support for RFB 3.8
Date: Tue, 22 Sep 2020 16:10:34 -0700	[thread overview]
Message-ID: <CAHjwAuyDhFpEUtLZuGXSpRTzA+8JNS8E0mpxouqOEvmagy2q+g@mail.gmail.com> (raw)
In-Reply-To: <CABJnqBRGr4cjFJsnuSjEUjHWtRyvDd2Pq9xZ=2Xn3jOziWKEiw@mail.gmail.com>

Well beyond just the usual "avoid magic numbers" advice, with version
numbers in particular enums let you use a format like VERS_3_8 or so
to make the inherent separation more clear, especially to distinguish
between something like 3.11.1 and 3.1.11.

- sam-d

On Tue, Sep 22, 2020 at 1:58 PM Iruatã Souza <iru.muzgo@gmail.com> wrote:
>
> Le mar. 22 sept. 2020 à 22:36, Silas McCroskey <inkswinc@gmail.com> a écrit :
>>
>> > +    if(strncmp(msg, "RFB 003.008\n", VerLen) == 0)
>> > +        srvversion = 38;
>> > +    else
>> > +        srvversion = 33;
>>
>> > +            if (srvversion == 38)
>>
>> This kind of thing should almost certainly be using enums instead of
>> magic numbers.
>>
>>  - sam-d
>
>
> Usually I would promptly agree with that suggestion, but it got me thinking. In our specific case, is srvversion == SrvVersion38 actually clearer than srvversion == 38?
>
> In any case, I would happily change the patch if enums are preferred.


  parent reply	other threads:[~2020-09-22 23:10 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-22 17:37 Iruatã Souza
2020-09-22 18:25 ` Iruatã Souza
2020-09-22 20:08   ` [9front] " ori
2020-09-22 20:11     ` ori
2020-09-22 20:36       ` Silas McCroskey
     [not found]         ` <CABJnqBRGr4cjFJsnuSjEUjHWtRyvDd2Pq9xZ=2Xn3jOziWKEiw@mail.gmail.com>
2020-09-22 23:10           ` Silas McCroskey [this message]
2020-09-22 23:31             ` hiro
2020-09-22 23:25 ` [9front] " ori
2020-09-23  6:41   ` Iruatã Souza
2020-09-26 19:58     ` ori
2020-09-26 20:42       ` hiro
2020-09-26 21:31         ` ori
2020-09-27 17:12       ` Iruatã Souza
2020-09-27 16:58         ` ori
2020-09-26 19:39   ` kvik
     [not found] <CABJnqBR7QoJVOVkgpi-jr1-2NgJ1NsTq5ha_hsuq7oNTfiJAnA@mail.gmail.com>
2020-09-22 20:46 ` [9front] " ori

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAHjwAuyDhFpEUtLZuGXSpRTzA+8JNS8E0mpxouqOEvmagy2q+g@mail.gmail.com \
    --to=inkswinc@gmail.com \
    --cc=9front@9front.org \
    --cc=iru.muzgo@gmail.com \
    --cc=ori@eigenstate.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).