From: Sean Middleditch Date: 2002-04-12T03:36:38+09:00 Subject: Re: Is eval a code/design smell? On Thu, 2002-04-11 at 14:19, Paul Brannan wrote: > On Fri, Apr 12, 2002 at 02:56:46AM +0900, Sean Middleditch wrote: > > Of course, with C++, you do directly access any byte in memory owned by > > the program you want, so things like public/private/friend are simply > > there as "safety" checks - not any kind of true protection or security > > mechanism. > > It's more than that. In C++, bypassing the access control is undefined. > > You must first find out the memory location where the data you want is. > There is no portable way to do this. It's perfectly legal for a > compiler to only allow this kind of access on Tuesdays between 6:30 and > 10:00pm. > > GOTW has an interesting (and somewhat humorous) article on the subject: > > http://www.gotw.ca/gotw/076.htm Ya, well, still - the point is, it's possible, whereas in Ruby (assuming no C extensions, which is similar to assuming a C program doesn't include kernel extensions) you are forced to play by the rules Ruby lays down. You can't, or shouldn't be able to, play dirty tricks on the interpreter. With C/C++, assuming I know what compiler/OS the code will be compiled on, I can very easily figure out what the byte locations will be, and access those; even using some funky type-casting if I have to (depending on compiler). > > Paul >