POV-Ray : Newsgroups : povray.off-topic : Saw a weird C++ construct I'm not sure I understand... : Re: Saw a weird C++ construct I'm not sure I understand... Server Time
7 Sep 2024 03:23:00 EDT (-0400)
  Re: Saw a weird C++ construct I'm not sure I understand...  
From: Fredrik Eriksson
Date: 20 Aug 2008 12:34:08
Message: <op.uf61m5qe7bxctx@e6600>
On Wed, 20 Aug 2008 18:23:49 +0200, Darren New <dne### [at] sanrrcom> wrote:
> I saw a bit of a note describing how to use an "assert" and a "check"  
> call in some C++.  "Assert" would exit the program if it failed, and  
> "check" would let the program continue after logging in order to look  
> for more failures.
>
> But the invocation was along the lines of
>
> assert(x < 10) <<
>     "The value x is " << x << " but that's too small";
>
> The only way I can see this working is if assert returns either a  
> subclass with operator<< defined to do nothing, or with operator<<  
> defined to log something. In the latter case, the destructor would exit  
> the program?  Would that work?

I do not see why it would not.



-- 
FE


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.