Project 2 Frequently Asked Questions

Updated 10/6/2019

The most recent items appear first.


On CAEN, when I issue the "module load gcc/9.1.0" command, I get an error message: 

Module 'gcc/9.1.0' conflicts with the currently loaded module(s) 'gcc/6.2.0'

How do I fix this?

It looks like this is coming from your .bash_profile Linux startup file, where in 281 you were required to add this. Edit this file and either remove the "module load gcc/6.2.0" command, or change it to load 9.1.0 instead. You can also issue an unload command followed by the desired load command.  See

https://caenfaq.engin.umich.edu/clse-for-linux/how-are-environment-modules-used-in-the-clse-for-linux


I'm getting a failure to match the demos in my String operator+ implementation, even though it is simple and makes sense! I'm simply returning

return temp += rhs;

What's wrong?

This is pretty subtle. Notice that operator+ returns a String by value. But since += returns a reference to temp, the compiler concludes that it needs to copy temp's value out of the function to be the return value. However, we could return the local temp variable instead: 

temp += rhs;

return temp;

The compiler concludes that it can move the value of temp to be the return value.

To match the demos, use the second form; the first form is unnecessarily terse anyway.