Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!hao!oddjob!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.unix.xenix Subject: Re: uPort 1.3 cc static char * Message-ID: <9468@mimsy.UUCP> Date: Sun, 22-Nov-87 12:46:13 EST Article-I.D.: mimsy.9468 Posted: Sun Nov 22 12:46:13 1987 Date-Received: Wed, 25-Nov-87 02:51:31 EST References: <471@petro.UUCP> <1120001@hpisoa2.HP.COM> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 28 jrb@petro.UUCP (Jon Boede) notes <>... when using the -Ml (large) model the following crashed and burned... <> <>main() <>{ <> char *a_pointer; <> <> a_pointer = "some static data"; <> <> puts(a_pointer); <>} <> <>However, when I change a_pointer to "static char *a_pointer" it works. Why? In article <1120001@hpisoa2.HP.COM> jackg@hpisoa2.HP.COM (Jack Gerson) writes: >You didn't allocate memory for your character array, so it's no surprise >your process crashed. Nope. Quoted strings ("some static data") are put by the compiler into some initialised space (text or data); the `value' of such an expression is a pointer of type `(char *)' which points to the first character of the string. In other words, if the program shown above crashes, the compiler or support library is broken. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris