Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!snorkelwacker.mit.edu!mit-eddie!uw-beaver!zephyr.ens.tek.com!tektronix!reed!glacier!busker!f20.n226.z1.FIDONET.ORG!Keith.Rollin From: Keith.Rollin@f20.n226.z1.FIDONET.ORG (Keith Rollin) Newsgroups: comp.sys.mac.programmer Subject: Re: Increment (Was Re: Pascal deficiency)? Message-ID: <647.2783DF06@busker.fidonet.org> Date: 28 Dec 90 08:45:49 GMT Sender: ufgate@busker.fidonet.org (newsout1.26) Organization: FidoNet node 1:226/20 - cmhGate UF Gateway, Columbus OH Lines: 40 Reply-To: keith@Apple.COM In article <1530@carol.fwi.uva.nl> freek@fwi.uva.nl (Freek Wiedijk) writes: >keith@Apple.COM (Keith Rollin) writes: >> Another interesting thing is that empty() is >>reduced to a simple RTS. Should an optimizing compiler recognize >>that this is a null procedure, and remove the call to it altogether? > >What happens if you declare empty static and compile the program with the >flag -finline-functions? I do not have gcc for MPW, so I cannot try it >myself. I am very curious what will be left. Pretty slick! The program: static void empty(int i) {}; main() { int i = 1; empty(++i); }; reduces to: Module: Flags=$00=(Local Code) Module="main%"(1) Segment="Main"(2) 00000000: 4E56 0000 'NV..' LINK A6,#$0000 00000004: 4E5E 'N^' UNLK A6 00000006: 4E75 'Nu' RTS Now...I wonder why the LINK/UNLK are still there. I also used -mbg off, so it's not for debugging purposes... -- ------------------------------------------------------------------------------ Keith Rollin --- Apple Computer, Inc. --- Developer Technical Support INTERNET: keith@apple.com UUCP: {decwrl, hoptoad, nsc, sun, amdahl}!apple!keith "Argue for your Apple, and sure enough, it's yours" - Keith Rollin, Contusions + Organization: Apple Computer Inc., Cupertino, CA -- Keith Rollin - via FidoNet node 1:105/14 UUCP: ...!{uunet!glacier, ..reed.bitnet}!busker!226!20!Keith.Rollin INTERNET: Keith.Rollin@f20.n226.z1.FIDONET.ORG