Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!ncar!tank!shamash!nic.MR.NET!thor.acc.stolaf.edu!mike From: mike@thor.acc.stolaf.edu (Mike Haertel) Newsgroups: comp.lang.c++ Subject: Re: the secret bang Message-ID: <7385@thor.acc.stolaf.edu> Date: 17 Oct 89 04:09:59 GMT References: <1167@osc.COM> Reply-To: mike@thor.stolaf.edu () Organization: St. Olaf College, Northfield, MN Lines: 31 In article <1167@osc.COM> strick@osc.com (henry strickland 415-325-2300) writes: >// Here's one for your C++ puzzle book. > [ . . . ] >// Curious to AT&T cfront2.0 is the undocumented postfix-bang operator. >// It can only be used in type declarations, to mean the same thing as >// the prefix-star operator or the postfix-empty-brackets operator. >// The secret bang is demonstrated in v4(), v5(), and r4(). > [ . . . ] >// Any conjectures why the secret bang is there? Wasn't postfix "!" a >// dereference operator in BCPL? Know of any other C or C++ >// implementations that accept it? Obviously, the use of a postfix "pointer" declarator obviates the need for the (sometimes very tricky) parenthesization of complex declarations. Consider the (C) declaration: void (*signal(int, void (*)(int)))(int); If we take ! as a postfix declarator that means the same as * we get: void signal(int, void !(int))!(int); which can literally be read from left to right. Ravi Sethi wrote a really neat paper about this. -- Mike Haertel ``There's nothing remarkable about it. All one has to do is hit the right keys at the right time and the instrument plays itself.'' -- J. S. Bach