Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!uhccux!munnari.oz.au!otc!metro!bunyip!uqcspe!qfagus!anvil!michi From: michi@anvil.oz (Michael Henning) Newsgroups: comp.lang.c++ Subject: typedef void Keywords: typedef, syntax, void Message-ID: <653@anvil.oz> Date: 24 Jul 89 23:06:28 GMT Organization: Anvil Designs Pty Ltd, Brisbane, Australia Lines: 42 This probably belongs into comp.lang.c, but we do not get this group here, and it is also relevant to C++. The recent posting of nn had a typedef relating to signal handlers to handle the differing return types of signal handlers. Example: typedef void sig_type; sig_type handler() { } Under AIX 2.2.1, the compiler produces an error message: "line 1: void type for sig_type". Under Xenix386 V2.3, the compiler gives: "warning 43: 'sig_type' : void type changed to int". My question is whether the above typedef is valid C (C++). All my references seem to indicate that the typedef is OK, and the presence of the definition in nn seems to indicate that at least some compilers accept it. Given that a typedef looks like the equivalent variable declaration with the typedef keyword added to establish the alias, but that it is not possible to declare a variable of type void, does that mean that the typedef is automatically invalid as well ? Any help on this would really be appreciated. According to the C language definition, the typedef is valid syntax. Are there any (defined) semantic restrictions forbidding such a definition ? Thanks, Michi. -- | Michael Henning | Internet : michi@anvil.oz{.au} | | Anvil Designs | JANET : michi%anvil.oz@uk.ac.ukc | | P.O. Box 954 | ARPA,Bitnet: michi%anvil.oz.au@uunet.uu.net | | Toowong 4066, Australia | UUCP : ...!uunet!munnari!anvil.oz!michi |