[tor-bugs] #27253 [Core Tor/Stem]: Decide: rename Size subclasses to indicate unsigned and bit counts

Tor Bug Tracker & Wiki blackhole at torproject.org
Wed Aug 22 03:02:25 UTC 2018


#27253: Decide: rename Size subclasses to indicate unsigned and bit counts
-------------------------------+-----------------------------------------
     Reporter:  dmr            |      Owner:  atagar
         Type:  enhancement    |     Status:  new
     Priority:  Medium         |  Milestone:
    Component:  Core Tor/Stem  |    Version:
     Severity:  Normal         |   Keywords:  client dev code-improvement
Actual Points:                 |  Parent ID:
       Points:                 |   Reviewer:
      Sponsor:                 |
-------------------------------+-----------------------------------------
 I wanted to make sure this got specifically addressed before a stem.client
 release, since after that point it might be too late (due to backwards-
 compatibility concerns).

 From [[ticket:26227#comment:4]]:
 > ==== Naming: `stem.client.datatype.Size` subclasses/attributes
 > **Suggestion**:
 > It might be good to switch `CHAR`/`SHORT`/etc. to `UCHAR`/`USHORT`/etc.
 > I don't know what the convention is here, but it may help for
 readability.
 >
 > I'm personally used to `U<size>` to signify unsigned and `<size>` to
 signify signed. I think switching to `U<size>` would make the code
 //potentially// easier to read for newcomers from various backgrounds.
 >
 > **Suggestion**:
 > Similarly, it may help to put the bits length in it, too - for the most
 immediate readability.
 > So, e.g.:
 > * `UCHAR8`
 > * `USHORT16`
 > * etc.
 >
 > For reference, on a quick glance...
 > * [[https://gitweb.torproject.org/trunnel.git/tree/README|trunnel]]
 [[https://gitweb.torproject.org/trunnel.git/tree/lib/trunnel/Grammar.py?id=c6e8a499f5a5f00113ea268cfcef9e7676c6ed96#n86|appears
 to use]] `u8`, `u16`, etc.
 > * `tor`
 [[https://gitweb.torproject.org/tor.git/tree/src/common/torint.h?id=1b04dab60c549d9f0d621e1a115cab8a49c839f9|appears
 to use]] `uint8_t`, `uint16_t`, etc.

 atagar: thoughts?

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/27253>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list