Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!philabs!cmcl2!harvard!husc6!panda!genrad!decvax!cwruecmp!hal!rich From: rich@hal.UUCP (K. Richard Magill) Newsgroups: net.lang.c Subject: problem with unions (query) Message-ID: <175@hal.UUCP> Date: Wed, 4-Jun-86 11:51:00 EDT Article-I.D.: hal.175 Posted: Wed Jun 4 11:51:00 1986 Date-Received: Sat, 7-Jun-86 00:49:48 EDT Reply-To: rich@hal.UUCP (K. Richard Magill) Organization: CWRU Dept. Epid. & Biostat., Cleveland, OH Lines: 28 Keywords: unions casts types return I have a problem saying what I want to say. The basics look like: (vax 4.2) typedef union { char *c; int *i; } U; U f() { return("mumble"); } Which naturally is of the wrong type but casting the (char *) into (U) doesn't work either. This works but is ucky and -O doesn't rip out "one". U f() { U one; one.c = "mumble"; return(one); } Am I missing something obvious? K. Richard Magill ...decvax!cwruecmp!hal!rich