[pacman-dev] [PATCH] Use C18 language standard

Anatol Pomozov anatol.pomozov at gmail.com
Tue Mar 31 20:12:58 UTC 2020


Hi

On Fri, Mar 27, 2020 at 4:08 PM Allan McRae <allan at archlinux.org> wrote:
>
> On 28/3/20 5:52 am, Anatol Pomozov wrote:
> > Hey
> >
> > On Thu, Mar 26, 2020 at 8:47 PM Allan McRae <allan at archlinux.org> wrote:
> >>
> >> On 27/3/20 7:13 am, Anatol Pomozov wrote:
> >>> C18 is the latest released version of the language spec. The toolchains support
> >>> it starting with GCC 8.1.0 and Clang 7.
> >>>
> >>
> >> GCC 8.1.0 - May 2, 2018
> >> Clang 7 - 19 September 2018
> >>
> >> So available for 18 months.  Seems reasonable given the next release is
> >> a few months out minimum.
> >>
> >> But why do we need this version?   What feature will be used?  Is C11
> >> enough?
> >
> > C18 is mostly a clarification on top of C11 language spec. C18 does
> > not introduce any new language features
> > http://www.iso-9899.info/wiki/The_Standard#C18
>
> Hence why do we need that.  Every newer bit of software we require
> limits where pacman can be built.

C18 is the latest stable specification of the language that is
supported by modern toolchains.
It sounds reasonable to me if pacman keeps up with the technology
stack and uses its advancements.

Are you saying that C18 requirement introduces limits due to
requirement of this 2 years old toolchains? Just curious what
platforms where pacman is used lacks these toolchains?

> > C11 is what was a big step for C language. I use C11 feature in my
> > other projects and I really like it. Some of my favorite features are:
> >  - type-generic expressions. This is a poor-man generic that can be
> > used in macros. Quite useful in some cases for example instead of
> > having htobe16/htobe32/htobe64/.. this feature allows to have a macro
> > htobe() with functionality that depends on the parameter type.
> >  - _Thread_local specifier that allows to introduce a thread-local variables
> >  - defines for atomic types + functions for accessing the vars in atomic way
>
> I don't need to know what is in the standard.  What features do you plan
> to use in the pacman code base and where?

It is not really required to use all the spec features right away. But
having an option to use it in the future is gonna be useful.

As of particular use case - if in the future we decide to speed-up the
installation with more thread-level parallelism (e.g. checking
signatures/unpacking/... on multiple CPUs) then better C11
mutlithreadding support is very useful.


More information about the pacman-dev mailing list