Garrett D'Amore writes: > [EMAIL PROTECTED] wrote: > > Rather than speculate, measure! Profile some examples. > > I don't know of any compiler where a const non-pointer parameter makes > > any difference. > > Ian. > > And, with modern systems, its hard to tell whether use of "register" is > worthwhile either. The "register" hint may often mean that the compiler > winds up consuming a value in a register, and can't schedule the > register for somewhere that is even *hotter*. IMO, most of these > "hints" to the compiler should be avoided, because in a lot of cases the > programmer "guesses" poorly. (The other thing is that sometimes the > "guess" is good on one architecture, perhaps one with more registers, > and less accurate on another one that has fewer registers.)
Quite true, and for that reason there's a cstyle rule that prohibits the use of 'register' in ON. Still, I sometimes miss one nice feature of that keyword: it's a promise by the programmer that he will never take the address of the object. Much as 'const' is a promise not to write through a pointer, and helpful in keeping such a design assertion consistent, 'register' is helpful in saying that nobody should ever try to refer indirectly to the value. Oh well. It wasn't all _that_ valuable anyway. -- James Carlson, Solaris Networking <[EMAIL PROTECTED]> Sun Microsystems / 35 Network Drive 71.232W Vox +1 781 442 2084 MS UBUR02-212 / Burlington MA 01803-2757 42.496N Fax +1 781 442 1677 _______________________________________________ opensolaris-code mailing list opensolaris-code@opensolaris.org http://mail.opensolaris.org/mailman/listinfo/opensolaris-code