Given the following in C++(you might be surprised):
unsigned short x=0xFFFF;
unsigned short y=0xFFFF;
auto z=x*y;
std::cout << z;
Without checking, assuming an LP64 system what is the result:
A. 4294836225
B. -131071
C. fffe0001
D. Undefined behavior
#Cplusplus
#Cpppolls
-
Prikaži ovu nit
-
First of all big h/t to
@Myriachan whom I learned this devious example from
The answer is D, this is undefined behavior but how you might protest, unsigned number don’t have undefined behavior on overflow, do they?6 replies 3 proslijeđena tweeta 19 korisnika označava da im se sviđaPrikaži ovu nit
@tryfinally
@Yes_I_Know_IT
@RedwoodCoast
@iurii_k
@s2w2e
@Lambda_Coder
@SushiDude
@0player
@jbit_net
@m_grym
@OctavioCruz
@mrkn
@rfymf
@packetsource
@Matt_Huszagh
@Andreas_GA
@JMegyu
@BorjeGranberg
@timcharper
@hennichodernich
@dibsonmuad
@nop315
@hkoba
@ydah_
@nei_phi213km
22:51 - 30. sij 2020.
0 replies
0 proslijeđenih tweetova
3 korisnika označavaju da im se sviđa
Čini se da učitavanje traje već neko vrijeme.
Twitter je možda preopterećen ili ima kratkotrajnih poteškoća u radu. Pokušajte ponovno ili potražite dodatne informacije u odjeljku Status Twittera.