www.digitalmars.com         C & C++   DMDScript  

c++.chat - Bug or No Bug ??? - test.cpp

The attached file is a small program that creates 2 classes.
all functions are defined inline.

The operator<< is overloaded to be able to sent to the object everything that
neeeds to be done.

The first class cTestIf has an if-statement in the operator<<(char *_txt)
the second class cTestNot has this if-statement in a shortened version

I was quite surprised seeing that both reacted differently :

the first :
I*IHello World!I*
I*IHello World!I*
I*IOne Step BeyondI*

the string only gets updated after the whole line is processed

the second
N*NHello World!N*
N*NOne Step BeyondN*
N*NStep TwoN*

the string is updated before the next operator<< is executed

Is this normal behaviour or is this a bug in how the 2 if-statements are treated
by dmc compiler/linker ?

--

Nascar

Mens Sana In Corpore Sano
begin 0644 test.cpp



M87);<W1R;&5N*%]T>'0I73L <W1R8W!Y*'1T+%]T>'0I.R!T>'0]='0[('T-


M>'0H8VAA<B`J7W1X=#U.54Q,*0T*("` ("![(&-H87( *G1T/6YE=R!C:&%R
M6W-T<FQE;BA?='AT*5T[('-T<F-P>2AT="Q?='AT*3L ='AT/71T.R!R971U


M268F(&]P97)A=&]R/#PH8VAA<BH 7W1X="D-"B` ("` >R!I9B Q*2!C;W5T
M(#P



M8VAA<B`J='0];F5W(&-H87);<W1R;&5N*%]T>'0I73L <W1R8W!Y*'1T+%]T
M>'0I.R!T>'0]='0[('T-"B` ("!^8U1E<W1.;W0H*2![(#L ?0T*("` (`T*


M8VAA<B`J='0];F5W(&-H87);<W1R;&5N*%]T>'0I73L <W1R8W!Y*'1T+%]T
M>'0I.R!T>'0]='0[(')E='5R;B`J=&AI<SL ?0T*("` ("`-"B` (&-497-T
M3F]T)B!O<&5R871O<CP\*&-497-T3F]T)B!?='-T*0T*("` ("![(')E='5R


M("!C;W5T(#P
M9"!M86EN*"D-"GL-"B!C5&5S=$EF('1E<W0H(DAE;&QO(%=O<FQD(2(I.PT*

M="`\/"!T97-T+DYE=U1E>'0H(D]N92!3=&5P($)E>6]N9"(I(#P\("(J(B`\
M/"!T97-T+E1E>'0H*2`\/"`B*EQN(CL-"B!T97-T(#P\('1E<W0N3F5W5&5X
M=" B4W1E<"!4=V\B*2`\/"`B*B( /#P =&5S="Y497AT*"D /#P (BI<;B([

M96YD;#L-" T*('1E<W0R(#P\("(J(B`\/"!T97-T,BY497AT*"D /#P (BI<

M(BD /#P (BHB(#P\('1E<W0R+E1E>'0H*2`\/"`B*EQN(CL-"B!T97-T,B`\
M/"!T97-T,BY.97=497AT*")3=&5P(%1W;R(I(#P\("(J(B`\/"!T97-T,BY4
497AT*"D /#P
`
end
Oct 26 2004