Video about C++ reference parameters

My latest video blog is now available. This time I am looking at reference parameters in C/C++ and how they can reduce errors with pointer manipulation, but perhaps at the cost of code readability. You can see the video here or here:

Future video blogs will continue to look at topics of interest to embedded software developers. Suggestions for topics are always welcome via comment, email or social networking.

Want to stay up to date on news from Siemens Digital Industries Software? Click here to choose content that's right for you

Comments

2 thoughts about “Video about C++ reference parameters
  • Or you could code in a const safe manner.

    If the parameter isn’t a constant, reference or pointer, it can be changed.

    It’s self documenting that swap( int &, int &) can change both parameters… Where as swap( const int &, const int &) can not change them

    For complex types, non POD, the cost of an accidental deep copy, when you simply need the value makes const reference parameters crucial to high speed software development.

Leave a Reply

This article first appeared on the Siemens Digital Industries Software blog at https://blogs.sw.siemens.com/embedded-software/2018/03/26/video-about-c-reference-parameters/