Replace C_NONE with std::optional?
Whoever decided to move from fortran to C++: bless your soul.
I recently wrote a bug in my research code that happened as a result of using C_NONE with a size_t variable, which interprets C_NONE as the largest integer. The details of that don't particularly matter, but this made me realize something; there is a far more elegant way to handle the use of optional values.
This would be rather pretty, and the overhead of doing so should be on par with checking whether something has a value of C_NONE. However, this is a C++17 feature, and I understand there is a possibility that some people are forced to use ancient compilers. I believe this would increase the clarity of the code everywhere C_NONE is used (and that one scary place where ye olde F90_NONE is still used). Maybe someone else wouldn't waste time like I just did if this were used instead.
If anyone is inclined against this, I am not hurt to simply close this issue and forget the idea.
It was a collective decision and team effort to move to C++, and nothing short of a miracle that it actually happened. Unfortunately, the present state of the code is by no means idiomatic C++ because of the way that it was moved from Fortran to C++ piece by piece. I agree that there are better language constructs (especially things from the 17 and 20 standards) that could improve aspects of the code, although I'm not sure those are the lowest-hanging fruit in terms of improvements we could make. That being said, I'm in favor of leaving this issue open and once we do jump on the C++17 bandwagon we can consider where using std::optional would make sense. Thanks for the idea @gridley!