const int an_object = 0; const int * const MC_buf = &an_object; const int * buffer = MC_buf;
This code was original using structs, but it is simplified in this example.
It doesn't matter where the const declarations are, C51 refuses to compile it. It seems like it ought to work. In the real deal, I was planning on having groups pointers to arrays in various parts gathered in one location in arrays. But even in this simplified version, it doesn't work. Attempting to do anything like this just results in:
error C247: non-address/-constant initializer
What's more, the exact same thing works in GCC with language c and STRICT ANSI and doesn't produce any errors. In fact, I can dereference MC_buf and get the value of an_object.
Oh! I was completely zoning out on what that error message was saying and reading it wrong. Ha! I feel stupid now.
Thanks for the wake-up.