POV-Ray : Newsgroups : povray.off-topic : This is the sort of brokenness... : Re: This is the sort of brokenness... Server Time
6 Sep 2024 11:20:24 EDT (-0400)
  Re: This is the sort of brokenness...  
From: Darren New
Date: 21 Mar 2009 11:51:32
Message: <49c50d04$1@news.povray.org>
Warp wrote:
>   By the same logic this would also "break modularity":
> 
> T obj;
> T obj2 = obj;

Not really. operator= is declared in T.

>   All the data in obj is copied to obj2. This includes all the private data.

Only if you say that's how you want it to work.

>   However, the memcpy() version *is* breaking modularity because, as the
> text says, it's guaranteed to work only if the object contains scalar
> types. If you assume it does, you are breaking modularity.

You don't have to assume it does. You can read the header file and see it 
does. :-)

In any case, yes, you're breaking modularity. That's what we're saying, yes? 
Accessing private variables without the permission of the class breaks 
modularity?  Accessing private variables by address in a 
standards-conforming way breaks modularity. Given that you're agreeing with 
me, I'm not sure what the "however" in your sentence is supposed to imply.

-- 
   Darren New, San Diego CA, USA (PST)
   My fortune cookie said, "You will soon be
   unable to read this, even at arm's length."


Post a reply to this message

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