On Mon, Aug 29, 2016 at 10:13 PM, BartC <b...@freeuk.com> wrote: > In C, you can write this: > > int x; > > x = 5; > x = "hello"; > > With certain compilers (eg. gcc) you only get a warning. (And since I don't > show warnings to avoid inundation, that seems to compile fine for me!)
That's because strings, in C, are really pointers-to-char, and for hysterical raisins, pointers can be assigned to integers with just a warning. (Good code should have an explicit cast here.) You probably should have warnings enabled. There are a lot of faults that newer languages flag as errors, but due to backward compat restraints, C has to accept - but smart compilers will flag them as warnings. Getting inundated with warnings would be a major code smell. ChrisA -- https://mail.python.org/mailman/listinfo/python-list