[[Addition: April 2025]]
I went to ACCU 2025 where there were talks on contract assertions, a feature that has a bearing on this area. As of April 2025 contract assertions do not distinguish between function parameter values on entry and any modified value on exit. So there is no way make clear if a post condition variable refers to its value before or after. In other languages such as Eiffel, which have DbC built into the language, there are ways. Apparantly, this will be dealt with in C++, maybe by C++26. But in the meantime when one passes a fundamental type by value and does not use const in the cpp file, the value can be altered during function execution, since C++ is a pass by copy language. With such modifications it is possible for a post condition to inadvertently test a modified value. The standards committee are aware of this issue and suggest a remedy that I don't like at all. They say one should decorate such parameters with const. Since preconditions and postconditions are expressed on the function signature this means putting the const there. For symmetry I suppose they would also say that they must also be in the cpp file. I really don't like this, so my position of function parameters that are fundamental types passed by value stands. I will just have to wait for c++26.Sunday, March 27, 2022
Function parameters that are fundamental types passed by value and const
The rule is to not do this in the header file.
Some people say don't do it in the cpp file either (I am in that camp)
but this does seem to be a matter of opinion.
See the abseil article https://abseil.io/tips/109 for a discussion.
Windows, X11, cygwin, fonts and Xming
For years I used the X11 server that is part of cygwin. It seemed to be a bit flakey but there didn't seem to be anything better.
Every now and then I would run into a problem where it would seem to work but xterm would complain about missing fonts.
So, I downloaded and installed xming-fonts (from https://sourceforge.net/projects/xming/files/Xming-fonts/7.7.0.10/Xming-fonts-7-7-0-10-setup.exe/download) on my local node (not the node that was running xterm) and that fixed the error. These days I no longer use the cygwin X11. I use XMing: see http://www.straightrunning.com/XmingNotes.
Subscribe to:
Posts (Atom)