Do we really need const?

renoX renosky at free.fr
Tue Sep 18 11:34:17 PDT 2007


Janice Caron a écrit :
> About passing structs by reference: It's one of those things, like
> register or inline...
> 
> Once upon a time, programmers used the keyword "register" because they
> thought they could do a better job than the compiler at figuring how
> to use its registers.
> 
> Once upon a time, programmers used the keyword "inline" because they
> thought they could do a better job than the compiler at figuring out
> what to inline and what not.

Well in some (very limited) cases, they still do: I'm thinking about the 
  Linux kernels where developers do care and know (at least in some 
parts of the kernel) what the compiler do, of course this is not the 
usual case..


That said, I know that Sun's JVM has some 'escape analysis' optimisation 
  (or it's planned to have this) where it's able to put on the stack 
some of the objects, but I don't know how efficient it is in comparison 
to the developer choosing heap or stack allocation..

renoX



More information about the Digitalmars-d mailing list