P
Peteris Krumins
Hello again,
It's not clear enough for me when to use const and when not use const.
As I understand const should be used everywhere i have a variable which
should be put in read-only data (.rodata (is this segment standard for
read-only data (i mean title of it 'rodata'))?) segment. So by putting it
in .rodata segment i ensure the data can never be altered?
Should const be used everywhere it should be used, what improvments does
it make? If i precisely declare variables const where needed does the
compiler do it's job better?
For example,
int function(const char *data, int section) {
...
}
What's the difference if i had simply 'char *data' and not 'const char
*data'?
Anything about 'const' welcomed.
P.Krumins
It's not clear enough for me when to use const and when not use const.
As I understand const should be used everywhere i have a variable which
should be put in read-only data (.rodata (is this segment standard for
read-only data (i mean title of it 'rodata'))?) segment. So by putting it
in .rodata segment i ensure the data can never be altered?
Should const be used everywhere it should be used, what improvments does
it make? If i precisely declare variables const where needed does the
compiler do it's job better?
For example,
int function(const char *data, int section) {
...
}
What's the difference if i had simply 'char *data' and not 'const char
*data'?
Anything about 'const' welcomed.
P.Krumins