Path: utzoo!mnetor!uunet!husc6!tut.cis.ohio-state.edu!pike!mills-cl From: mills-cl@pike.cis.ohio-state.edu (christopher mills) Newsgroups: comp.lang.c Subject: Pointers to functions Message-ID: <7811@tut.cis.ohio-state.edu> Date: 7 Mar 88 02:51:15 GMT Sender: news@tut.cis.ohio-state.edu Organization: The Ohio State University Dept of Computer and Information Science Lines: 33 Keywords: pointers to functions Summary: Address arithmetic on (*)()'s /* I think D should have Ada-style comments... */ Hello there. I was writing a compiler for a simple C-like language of my own design for a single-board 6809 computer of mine, and I got around to the pointer arithmetic part and wondered what C does when you try to do pointer arithmetic on a pointer to a function. I figgured it would generate an error (since functions do not have a "size"), but being curious, I tried it on a few C compilers I had around. Suprisingly, many don't flag it as an error at all and do something implementation-defined and unpredictable (for example, Lattice C 3.10 on the Amiga treats it as if it were a char *, which I find odd, because it generates 68000 code which must be even-address aligned - I would have at least expected it to treat it as a short *). K&R doesn't say anything about this (as far as I know). I think it shows a breakdown in the typing system - pointers to functions aren't really pointers, but a distinct type. Thoughts? Flames? Oh, and as long as were on our D-wishlist, I'd like to be able to break and continue from more than one loop (yes, I am one of those people who use continue a lot). If this has already been mentioned, apologies - I'm getting on the tail-end of this one, because rn unsubscribed me when the system crashed and I hadn't noticed until now... Chris -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- _____________________ | Christopher Mills. (_)________________ \ | mills-cl@polaris.cis.ohio-state.edu ________________|\ \ | Current Thought: The trouble with good (_)______________\_\ \ | ideas is everyone wants you to do ______________________\ | something with them... (_)____________________| | DISCLAMER: I really wish I could blame | my thoughts on someone else... -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-