
Originally Posted by
Syndacate
I suppose it's possible, he didn't give me the usage, but I've seen some samples of it out there, meaning it is used...and if there's a pre-processor directive for it, that means it IS being used for SOMETHING, even if it's just replacing it with const. There's a reason they'd change the name, there's a reason somebody would use that name.
For my part, it was merely a semi-educated guess at the use of the word "rom." Never used it myself, and I am not likely to do so. ISO C does not have that keyword.

Originally Posted by
Syndacate
C doesn't have many (any?) keywords, they're all reserved, I believe.
?? C has as many keywords as specified by the standard. They are reserved in the sense that you may not use them as identifiers for anything else, e.g, :
Code:
int var1; /* OK */
int char; /* Not OK */

Originally Posted by
Syndacate
So you're saying if you made a pointer to it and then dereferenced it you could change the value? I mean I suppose there's no stopping you there...and there's no pass by ref in C so you'd most likely be using a pointer, in which all bets of protecting anything are off...so are you saying if you did something like:
Code:
cont int c = 5;
int b = c;
c = 10; // invalid - won't compile -- assume removed
b = 10; // valid, won't complain
printf("%d\n", c);
printf("%d\n", b);
--------------------------------------
prints:
10
10
Will work?
I don't know, I don't use const, to me it's an embarrassment of the language.
I was thinking of something more like this:
Code:
#include <stdio.h>
int main(void)
{
const int i = 5;
int *p = &i;
i = 4 /* !! Wrong. Cannot use identifier i to change contents of variable. */
*p = 4; /* We _can_ use any other identifier that points to the same place. */
printf("The value of i is %d\n", i);
return 0;
}
Now the compiler will complain when you try to compile, unless of course you do something evil, like this:
Code:
#include <stdio.h>
int main(void)
{
const int i = 5;
int *p = (int *) &i;
*p = 4;
printf("The value of i is %d\n", i);
return 0;
}
You can crank up the warnings, and the compiler will not give so much as a peep.