What is this string-literal in boolean expression idiom?
c, c++
Solution
I think it's so that if the assert fails you can see the reason why the assert was added.
Problem
A coworker of mine was looking through one of our inherited code bases and found the following line: `ATLASSERT( rtaddress == m_lRTAddress && "Creation settings should match FIFO" );` We don't understand what the purpose of the string literal is for; is it for more than just commenting? The way I see it, if `rtaddress` does NOT equal `m_lRTAddress` then the string will never be evaluated due to short circuiting. If `rtaddress` DOES equal `m_lRTAddress` then the string literal will be evaluated but a string literal evaluated for a boolean expression will always return `true`; so what's the point?