Re: C4239 - why here?



> void f(int& i)
> {
> i = 10;
> }
>
> double d = 0;
> f(d);
> //would you expect d to be 10?

Yes, I see. In fact, i would expect the compiler to refuse this outright, it
just makes no sense at all! Using intrinsic type promotions on references
like this, tsk, tsk, naughty compiler... Pascal doesn't allow this! Does C#?
I hope not :-))

But, that's not my situation. I have X as a "polymorphic worker class", and
it may or not change inside X, I don't care. I just want to it passed to F
to get polymorphic behaviour in F depending on the calling context).
Sort-of:
BaseX
{ virtual f() }
X1:BaseX { overridden virtual F() }
X2, X3...
and then F(BaseX&) gets called like this: F(X1(params)), F(X2(params)),
F(X3(params)) etc...

Goran.


.



Relevant Pages

  • Re: Microfocus COBOL 3.2.43 (16bit)
    ... Tsk tsk... ... dual processor IBM LS20 blade with dual fibre connections & eight gigs of ... NT Software, Compiler, etc. ... you could host it on a Windows Server or Windows Vista machine ...
    (comp.lang.cobol)
  • Re: C4239 - why here?
    ... In fact, i would expect the compiler to refuse this outright, it ... like this, tsk, tsk, naughty compiler... ... to get polymorphic behaviour in F depending on the calling context). ...
    (microsoft.public.dotnet.languages.vc)