Is the use of `const` dogmatic or rational?
问题 In Delphi you can speed up your code by passing parameters as const , e.g. function A(const AStr: string): integer; //or function B(AStr: string): integer; Suppose both functions have the same code inside, the speed difference between them is negligible and I doubt it can even be measured with a cycle-counter like: function RDTSC: comp; var TimeStamp: record case byte of 1: (Whole: comp); 2: (Lo, Hi: Longint); end; begin asm db $0F; db $31; mov [TimeStamp.Lo], eax mov [TimeStamp.Hi], edx end;