The Benefits of Constants

Posted by onaclov2000 on Stack Overflow See other posts from Stack Overflow or by onaclov2000
Published on 2010-03-26T15:50:05Z Indexed on 2010/03/26 15:53 UTC
Read the original article Hit count: 408

I understand one of the big deals about constants is that you don't have to go through and update code where that constant is used all over the place. Thats great, but let's say you don't explicitly declare it as a constant. What benefit(s) exist(s) to take a variable that HAPPENS to actually not be changed and make it a constant, will this save on processing, and/or size of code...etc?

Basically I have a program that the compiler is saying that a particular variable is not changed and thus can be declared a constant, I just wanted to know what the benefit to adding the constant qualifier to it would be, if it makes no difference then making that change adds no value and thus no point wasting time (this same scenario occurs in more then one place) going back and "fixing" all these variables.

Thank you, onaclov

© Stack Overflow or respective owner

Related posts about ada

Related posts about programming-languages