Do I need to lock static constants of a class in a multithreaded program?

Q1) Do I need to lock static constants of a class like string::npos that is accessed by multiple threads in a multithreaded program?

Q2) If I have a function that can be called by multiple threads and which takes in a reference parameter and does not lock it, is it safe so long as no reference to shared data is passed?
1) No. You don't need to synchronize access to any constants.
2) Sure, it's safe. Why are you having doubts?

You only need to synchronize when you have data structures that are written to and read from multiple threads.
2) Yes, it is safe, provided the function has no side-effects.
@PanGalactic: That's an ambiguous comment. Share to shed a little context on it? An example perhaps?
@Zaita: "side effect" is a well-defined term in CompSci. Wikipedia explains it much better than I could. http://en.wikipedia.org/wiki/Side_effect_%28computer_science%29
@PanGalactic: He said a static constant though.
@Zaita: Question 1 dealt with static constants. It's pretty clear from my response that I was answering question 2.
Topic archived. No new replies allowed.