Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!iuvax!purdue!decwrl!amdcad!crackle!tim From: tim@crackle.amd.com (Tim Olson) Newsgroups: comp.lang.c Subject: Re: Short code to determine compiler's Message-ID: <26470@amdcad.AMD.COM> Date: 23 Jul 89 20:55:20 GMT References: <396@uop.uop.EDU> <225800197@uxe.cso.uiuc.edu> <579@targon.UUCP> <171@bms-at.UUCP> <14497@dartvax.Dartmouth.EDU> <1038@cernvax.UUCP> Sender: news@amdcad.AMD.COM Reply-To: tim@amd.com (Tim Olson) Organization: Advanced Micro Devices, Inc. Sunnyvale CA Lines: 22 In article <1038@cernvax.UUCP> hjm@cernvax.UUCP (Hubert Matthews) writes: | I have a question for the authors of smart C compilers: is the | register declaration useful at all for such compilers? It indicates | that a variable is non-volatile, noalias and that taking its address | is illegal, all of which should make things easier for the optimiser. Yes, the register keyword does indicate such things, but they can all be determined by flow analysis anyway. If a local variable does not have its address taken, and it is non-volatile, then it is equivalent to "register". | So, does "register" help or hinder? Has it become a source-code | "no-op"? Can I merrily leave it out of my programs and let the | compiler do the guessing for me :-). It's a no-op, except for error messages that must be reported if a register variable's address is taken. In other words, it's more for diagnostic purposes than performance in "smart" C compilers. -- Tim Olson Advanced Micro Devices (tim@amd.com)