FSeam icon indicating copy to clipboard operation
FSeam copied to clipboard

C++14 support

Open mjvankampen opened this issue 5 years ago • 8 comments

Is your feature request related to a problem? Please describe. I develop using some more obscure operating systems (such as QNX) that mostly support C++14 and not newer. This means I cannot use FSeam.

Describe the solution you'd like If possible identify where C++17 is required and evaluate if those parts can be replaced by something C++14 compatible.

Describe alternatives you've considered Switching to other OS is not a possibility as these systems are hard-realtime.

mjvankampen avatar Jan 05 '20 16:01 mjvankampen

The usage of constexpr if is mainly the blocking point, we can implement some classic meta-prog to replace those but it may take some time (if I do such thing, I may do it on another branch as my goal with FSeam would be more going toward the most up to date version of C++).

FreeYourSoul avatar Jan 06 '20 10:01 FreeYourSoul

Alright, I understand. I do think FSeam has an excellent application area in embedded development where you would like to avoid virtual function calls. Unfortunately a lot of compilers are a bit older in that area and do not all support C++17 or newer. Especially in mission critical equipment where things like AUTOSAR guidelines are applied.

mjvankampen avatar Jan 30 '20 07:01 mjvankampen

I see, if you think FSeam may be used in actual projects only if it allows a retro-compatibility with lower standards version I would be happy to implement it, I am just scared of a potential ifdef/endif forest that would hinder the code readability.

FreeYourSoul avatar Feb 03 '20 13:02 FreeYourSoul

I agree with the forest. Maybe better to leave it as is and see if more people run into this. Otherwise C++17 might be ok.

mjvankampen avatar Feb 04 '20 20:02 mjvankampen

I would need c++11 support, if I can count as more people.

jpiw avatar Mar 03 '20 13:03 jpiw

I am thinking about a good way to do it. I will develop this when I have more time

FreeYourSoul avatar Mar 04 '20 17:03 FreeYourSoul

Can you elaborate on what the C++17 features are that FSeam is dependent upon?

sugdms avatar May 12 '20 02:05 sugdms

The biggest one is the usage of constexpr if. The best solution in order to support C++14, may be to remove the usage of constexpr if instead of using #ifdef which would really impact code readability. Overall, it shouldn't be too hard to modify as the template arguments are at function template level and not struct level. Doing some SFINAE on those templated method should do the trick.

constexpr if used in :

  • method ArgComp::compare : check arguments passed to a mocked function
  • method MockClassVerifier::verify : verify that all expected behaviors happened

FreeYourSoul avatar May 12 '20 12:05 FreeYourSoul