Opened 5 years ago

Last modified 5 months ago

#13260 needs_information defect

Transform code to cleaner c99 style

Reported by: nickm Owned by:
Priority: Low Milestone: Tor: unspecified
Component: Core Tor/Tor Version:
Severity: Normal Keywords: coccinelle, tor-client technical-debt
Cc: mcs, teor, ahf, catalyst Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

For #13233, we added a loose c99 requirement for building Tor. If we decide to keep it through the 0.2.6.x series, we can beautify our code a little.

Child Tickets

TicketStatusOwnerSummaryComponent
#27661newuse C99 bool from stdbool.h instead of int everywhereCore Tor/Tor

Change History (10)

comment:1 Changed 5 years ago by mcs

Cc: mcs added

comment:2 Changed 5 years ago by teor

Cc: teor added

comment:3 Changed 5 years ago by nickm

Milestone: Tor: 0.2.6.x-finalTor: 0.2.???

comment:4 Changed 3 years ago by teor

Milestone: Tor: 0.2.???Tor: 0.3.???

Milestone renamed

comment:5 Changed 3 years ago by nickm

Keywords: tor-03-unspecified-201612 added
Milestone: Tor: 0.3.???Tor: unspecified

Finally admitting that 0.3.??? was a euphemism for Tor: unspecified all along.

comment:6 Changed 2 years ago by nickm

Keywords: tor-03-unspecified-201612 removed

Remove an old triaging keyword.

comment:7 Changed 2 years ago by nickm

Cc: ahf catalyst added
Keywords: coccinelle tor-client technical-debt added
Priority: MediumLow
Severity: Normal

comment:8 Changed 2 years ago by ahf

We should probably figure out what we want to do here:

First two things I can think of:

  • Convert functions that returns 0 or 1 to return bool (true/false) from <stdbool.h>?
  • Lift for loop variables declarations into their loop initialiser?


Additionally, It might be interesting to figure out when/if we can start using C11 features?

comment:9 in reply to:  8 Changed 2 years ago by teor

Replying to ahf:

We should probably figure out what we want to do here:

First two things I can think of:

  • Convert functions that returns 0 or 1 to return bool (true/false) from <stdbool.h>?

We also want to make the crypto API return 0 and 1 rather than 0 and -1.
(I think there's a ticket for this already.)
Then we could convert it to use bool as well.

  • Lift for loop variables declarations into their loop initialiser?


Additionally, It might be interesting to figure out when/if we can start using C11 features?

When all supported compilers on all supported OSs support C11 (or whatever C11 features we want). Sometimes the Microsoft compilers are the slowest here.

Are there any particular features you have in mind?

comment:10 Changed 5 months ago by cypherpunks

Status: newneeds_information

It should be a C standard conformant code (C18 now) which can be compiled by any supported compiler (subset of C99 now). Right?

Note: See TracTickets for help on using tickets.