File tree 1 file changed +9
-11
lines changed 1 file changed +9
-11
lines changed Original file line number Diff line number Diff line change 790
790
791
791
\pnum
792
792
\begin {example }
793
+ If \tcode {float} does not adhere to \IsoFloatUndated {}
794
+ and cannot represent positive infinty,
795
+ a sufficiently large \tcode {double} value will be
796
+ outside the (finite) range of \tcode {float}.
793
797
\begin {codeblock }
794
798
void f() {
795
- double d = FLT_MAX * 16 ;
799
+ double d = FLT_MAX;
796
800
d *= 16;
797
801
float f = static_cast<float>(d); // undefined behavior.
798
802
}
799
803
\end {codeblock }
800
804
\end {example }
801
805
802
806
803
- \pnum
804
- \begin {example }
805
- \begin {codeblock }
806
-
807
- \end {codeblock }
808
- \end {example }
809
-
810
807
\pnum
811
808
\ubxref {expr.static.cast.downcast.wrong.derived.type } \\
812
809
Down-casting to the wrong derived type is undefined behavior.
1347
1344
\begin {codeblock }
1348
1345
extern int &ir1;
1349
1346
int i2 = ir1; // undefined behavior, \tcode {ir1} not yet initialized
1350
- int ir1 = 17;
1347
+ int i3 = 17;
1348
+ int &ir1 = i3;
1351
1349
\end {codeblock }
1352
1350
\end {example }
1353
1351
1674
1672
}
1675
1673
void f()
1676
1674
{
1677
- X& px = &g();
1675
+ X* px = &g();
1678
1676
px->~X();
1679
- int*p = px->i; // undefined behavior
1677
+ int j = px->i; // undefined behavior
1680
1678
}
1681
1679
\end {codeblock }
1682
1680
\end {example }
You can’t perform that action at this time.
0 commit comments