[yoshimi] Re: C++ version

  • From: Chris Ahlstrom <ahlstromcj@xxxxxxxxx>
  • To: yoshimi@xxxxxxxxxxxxx
  • Date: Sun, 2 May 2021 15:04:53 -0400

When I forked Sequencer64 to Seq66, I did the following things:

1. Changed most of the for loops to use "for (auto ... x : m_container)"
  notation.

2. Changed long sequences of if-statements to code that:

  a. Used std::map or multimap lookup to find a keystroke or MIDI control
     quickly.

  b. Once the lookup occurred, call the lambda function that was stored
     at startup for that key/MIDI control.

3. Took advantage of enum class to change a number of regular enumerations
  and macro definitions with more readable tokens like "timebase::master"
  or "automation::ctrlstatus::learn".  Similarly, created namespaces into
  which to embed codes: In namespace keyboard, defined enum class layout so
  that client code can refer to "keyboard::layout::azerty".

4. Replaced bare C calls with their corresponding "std:xxxx()" calls. Also
  used conversions functions like std::stoi() and std::to_string().

5. Added keywords such as "final" to prevent accidental derived classes
  and "override" to flag derived versions of virtual functions.

6. Removed copy constructors and principal assignment operaters using
  "= delete".  Replaced a lot of rote copy constructors and principal assignment
  perators with "= default" declarations.

That's all I can recall off the top o' me head. Was able to reduce the number of
lines of code by a fair amount, and surely increaased the speed of the code.

On the other hand, some of my ports were... unfortunate.  See issue #51 in Seq66
to see how I broke JACK transport!  D-:


-------- Will Godfrey 17:11 Sat 01 May      --------


Would we actually gain anything by requiring a minimum of C++17 ?
It's now just over 4 years old so I would think just about every compiler out
there has had a stable implementation of it for some time.

I've no strong feelings either way myself, but want to be sure we don't leave
anyone behind.

--
Will J Godfrey
https://willgodfrey.bandcamp.com/
http://yoshimi.github.io
Say you have a poem and I have a tune.
Exchange them and we can both have a poem, a tune, and a song.
Yoshimi source code is available from either: 
https://sourceforge.net/projects/yoshimi
Or: https://github.com/Yoshimi/yoshimi
Our list archive is at: https://www.freelists.org/archive/yoshimi
To post, email to yoshimi@xxxxxxxxxxxxx

--
Unknown person(s) stole the American flag from its pole in Etra Park sometime
between 3pm Jan 17 and 11:30 am Jan 20.  The flag is described as red, white
and blue, having 50 stars and was valued at $40.
                -- Windsor-Heights Herald "Police Blotter", Jan 28, 1987
Yoshimi source code is available from either: 
https://sourceforge.net/projects/yoshimi
Or: https://github.com/Yoshimi/yoshimi
Our list archive is at: https://www.freelists.org/archive/yoshimi
To post, email to yoshimi@xxxxxxxxxxxxx

Other related posts: