I was wondering if the comment "x must be 2" was intended to be a wrong assumption or not, in:
on page 371 in K&B (as x being say, 3, and y being false reaches it). I would have understood it if a later example would have used the snippet with a real assertion ( assert( x == 2) ; ) to prove that the assumption was wrong. But it doesn't, and the example seems to illustrate solely that sometimes we are used to put assumptions in comments.
Just checking, sorry for horrible nitpicking. [ July 08, 2008: Message edited by: Ronald Schild ]
Nice catch I think the comment merely intends to illustrate that assumptions can be added to the source code in the form of debug comments. Of course, as you said, the assumption is faulty in this case - and I can't imagine it was meant to be. Seeing as the text following the code snippet never refers back to it in trying to prove the debug comment wrong using the assertion mechanism.
Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: K&B doubt - p371, question about assumption remark