|
|
|
|
|
by LegionMammal978
989 days ago
|
|
>> I’ll cast away the const if needed. > Undefined behavior[2] How so? As the page you linked mentions, simply casting 'const T *' to regular 'T *' is well-defined; it's only modifying a const object through the pointer that's UB (C17 6.7.3/7). > I don't believe assignments are sequence points and only the function call is. Assigments within expressions don't create sequence points. However, the expression of an expression statement is a full expression (i.e., not a subexpression of another expression), and there is a sequence point between each pair of full expressions (C17 6.8/4). In other words, the semicolons create sequence points. |
|