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
CC
@qub1750ul
@avborhanian
@Wareya
@aronchick
@masayang
@rajeshposts
@ItsChoudhry
@eborisch
@VKrevs
@stilescrisis
@JacoboEnMty
@CliffStanford
@samikshan
@infantnaveen
@douglasdd
@hadrami_z
@chrfrenning
@bobrippling
@WaqrAhmd
@robermorales
@richardhoward
@mkerrisk
@leo60228
22:51 - 30. sij 2020.
0 replies
0 proslijeđenih tweetova
5 korisnika označava 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.