Practice ยท 3 of 6
Classify the Contract
CHALLENGE
Difficulty: advanced+25 XP
Implement const char* classify(int code) mapping each code to its standard-contract class for the construct described:
- code 0: reading sizeof(int) โ returns "implementation-defined"
- code 1: the value of an uninitialized automatic int โ returns "indeterminate"
- code 2: signed integer overflow โ returns "undefined"
- code 3: order of evaluation of two function arguments โ returns "unspecified"
- code 4: unsigned int wraparound on overflow โ returns "well-defined"
Any other code returns "unknown".
Press Submit to check your solution.
Back to lesson: Practice: Object Layout Forensics