using const & in function prototypes



Folks,

I am probably getting an unreasonable doubt with the VC8 compiler, so before I go overboard with details and background, I would like to ask this simple C/C++ question:

In code where I might have:

BOOL func(DWORD ref);

changing this to:

BOOL func(const TINT &ref);

where TINT is

#define TINT DWORD

Is there something I should be aware under the current VC8+ compilers or I should "watch for" or be aware of when using this syntax that might possible change logic in my function code block?

Of course, this is only done if the function code block is not changing the variable which the new compiler would catch and error out such logic where an attempt was made to change a const variable.

I ran into a situation where the only difference is the above and I am getting different unexpected results. So before digging deeper to see whats happening, was I correct in my long time thinking that the above syntax was ok and proper?

Thanks
===
.



Relevant Pages

  • Re: using const & in function prototypes
    ... I would naturally assume that this would be a transparent difference in OP codes and that the end result is the same. ... BOOL func(const TINT &ref); ... Is there something I should be aware under the current VC8+ compilers or I should "watch for" or be aware of when using this syntax that might possible change logic in my function code block? ... this is only done if the function code block is not changing the variable which the new compiler would catch and error out such logic where an attempt was made to change a const variable. ...
    (microsoft.public.vc.language)
  • Re: 64 bit VC compiler on VC++6.0 and VC++7.1
    ... do NOT support 64 bit compiler? ... (and also the PSDK/DDK compiler which is almost the same as the VC8 compiler) ... My blog about Win32 and .NET ...
    (microsoft.public.vc.language)

Loading