On 2015-11-07, Marko Rauhamaa <ma...@pacujo.net> wrote: > Grant Edwards <invalid@invalid.invalid>: > >> I take it you don't write embedded code that runs from ROM? I do. The >> const keyword is the most valuable addition to the C language since >> the function prototype. Without it, you used to have to jump through >> all sorts of hoops to get read-only data placed into read-only memory. > > If all you need is a linker directive that places data in a read-only > section, "const" is a very ineffective tool that clutters the code and > forces you to sprinkle type casts around your code.
But it allows the compiler to warn you if you pass a pointer to a read-only data to a function that expects a pointer to writable data. For those of us who occasionally make mistakes, such compiler warnings are very useful. -- Grant -- https://mail.python.org/mailman/listinfo/python-list