bug-texinfo
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: implementation language [was: library for unicode collation in C for


From: Per Bothner
Subject: Re: implementation language [was: library for unicode collation in C for texi2any?]
Date: Sat, 14 Oct 2023 10:19:34 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1

I'm not necessarily urging making use of any particular features of C++.
Just start small: use a C++ compiler and C++ file extensions.
(There is an unfortunate lack for standardization of extensions for C++
files. Gcc uses .cc - which seems as good as anything else.)

I do suggest when possible using std::string rather than C strings.
(There is pretty easy and convenient inter-operability between them.)

Personal history/anecdote:

In an old life, working for Cygnus, I wrote a lot of C++ and was active in the
C++ community. Then for many years I basically wrote no C++ and very little C.
It was mostly Java, and Scheme. I started exploring using JavaScript to 
implement
ideas for "next-generation" iterminals using JavaScript, This became DomTerm.

In 2017 I added a C-based backend to DomTerm, based on an existing C application
(ttyd) and a C networking library (libwebsockets).  That worked pretty well,
but in 2020 I converted the backend to C++. This has been a gradual conversion:
Some structs have become classes, and I've converted some functions to methods
(member functions).  I switched to using a C++ library for JSON. I use
templates for a lookup table that is used for 3 different value types.
As I change a section of code, I may replace C strings with std::string.

And so on. It still looks more like C than C++ in many places. There is no
inheritance and no virtual methods.  (I still use a table containing function
pointers in place of virtual methods.)  If I had started with C++, or if
I were more fluent in C++ than I am now, it would look different.
But the current hybrid is fine.
--
        --Per Bothner
per@bothner.com   http://per.bothner.com/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]