Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site watmath.UUCP Path: utzoo!watmath!kpmartin From: kpmartin@watmath.UUCP (Kevin Martin) Newsgroups: net.lang.c Subject: Register functions ? Message-ID: <8836@watmath.UUCP> Date: Sun, 2-Sep-84 15:42:00 EDT Article-I.D.: watmath.8836 Posted: Sun Sep 2 15:42:00 1984 Date-Received: Mon, 3-Sep-84 10:49:28 EDT References: <3@tikal.UUCP> Reply-To: kpmartin@watmath.UUCP (Kevin Martin) Organization: U of Waterloo, Ontario Lines: 28 > As long as I'm twiddling the semantics of the language, I'd like to > propose "register" functions like these: > > static register int func (arg, arg2) {...} > static register void func .... > > The purpose of the "register" (even for void !) is to prevent the > programmer from taking the address of the function. > teltone!warren I have had some thoughts about 'register' too. I see it as being a storage class modifier which tells the compiler that the value will not be changed in any 'sneaky' manner. If you think about it, this is its current meaning. For extern's, it becomes a promise that the named variable will not be changed by any functions I call. For functions it means it returns the same value if called with the same args, and has no side effects. One problem with this extension is that the compiler cannot enforce your promises in the same manner as it prevents sneak access to auto register variables (by preventing you from &'ing them). The other problem is due to interpreting 'register' as part of the storage class... What if I want a pointer to a "register function"? There is no syntax that fits... The only possible syntax is already used up by "register pointer" to "regular function"... Kevin Martin, UofW Software Development Group