Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!husc6!cmcl2!beta!unm-la!unmvax!hi!jedi!sundc!hadron!inco!mack From: mack@inco.UUCP Newsgroups: comp.lang.c Subject: Literal strings in C Message-ID: <212@inco.UUCP> Date: Wed, 10-Jun-87 12:59:07 EDT Article-I.D.: inco.212 Posted: Wed Jun 10 12:59:07 1987 Date-Received: Sat, 13-Jun-87 20:37:52 EDT Organization: McDonnell Douglas-INCO, McLean, VA Lines: 33 Keywords: l-valued vs r-valued There has recently been some discussion of literal strings in C in this group, and I thought I'd confuse the issue by pointing out a couple of real peculiarities. Both of the following statements are legal, executable C, at least to the Sun 3.2 C compiler, which is presumably based on PCC. c = "literal string"[i]; "literal string"[i] = c; The first form is not unreasonable (saves a character pointer, anyway.) The second statement seems utterly useless. Make of this what you will. Can anybody out there imagine a case where something like the second statement would be useful? Does the ANSI standard address this sort of thing? "C is not merely stranger than we imagine; it is stranger than we *can* imagine." -- ------------------------------------------------------------------------------ Dave Mack (from Mack's Bedroom :<) McDonnell Douglas-Inco, Inc. DISCLAIMER: The opinions expressed 8201 Greensboro Drive are my own and in no way reflect the McLean, VA 22102 views of McDonnell Douglas or its (703)883-3911 subsidiaries. ...!seismo!sundc!hadron!inco!mack ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++