   the significance of const modifier on parameters passed by value
  What's its significance, knowing that modifying them doesn't hurt any one else?thanks for help.xee..[edited by - xeee on February 3, 2004 6:54:26 AM]
  It makes sure that YOU remember that the value is passed by value. In the future you may change your code and not remember, or by mistake assign a value to the variable passed in, expecting it to change elsewhere in your program. ;  it could possibly lead to some optimisation of code (although that''s unlikely).There are programming styles which don''t modify the passed parameter so you can always refer to it all the way through the function and know that it hasn''t changed. This is enforced by const.This may be useful for long functions but modern programming style seems to be moving toward short functions, having classes made up of many functions. These encourage code reuse rather than duplication and help understanding. ;  Yeah, const is very much a keyword that helps to prevent silly errors by the programmer. As you see from the link given by petewood, it is unlikely that optimisations will occur. WHen it comes to modifing passed in parameters, the real issue is that ,yes it doesn''t hurt anyone else but why should you change the value? If you need to modify it, then it should be done in a second variable.IMHO passing objects by non-const value is probably a bad design in the language, although it can prevent copying if you need to slightly modify a large object. Almost always passing primitives by value you should declare them as const and objects should be declared as const if you don''t modify them.  