Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Determine read or write ?

Reply
Thread Tools

Determine read or write ?

 
 
LaBird
Guest
Posts: n/a
 
      06-26-2003
Dear all,

I'd like to know if there is any function or program call
in C++ (without memory protection support by OS),
that can determine whether an object is being read or
written? e.g.,

a = b + c; // a is being written while b and c are being read
a++; // a is being read and written

Also, is there any code that can determine the object
is a lvalue or rvalue?

I think it is possible if a, b and c are user-defined types
(as we can overload operator =, + and ++, and so on),
but how about primitive types?

Thanks in advance.

Regards,
LaBird (Benny).


 
Reply With Quote
 
 
 
 
Thomas Matthews
Guest
Posts: n/a
 
      06-26-2003
LaBird wrote:
> Dear all,
>
> I'd like to know if there is any function or program call
> in C++ (without memory protection support by OS),
> that can determine whether an object is being read or
> written? e.g.,
>
> a = b + c; // a is being written while b and c are being read
> a++; // a is being read and written
>
> Also, is there any code that can determine the object
> is a lvalue or rvalue?
>
> I think it is possible if a, b and c are user-defined types
> (as we can overload operator =, + and ++, and so on),
> but how about primitive types?
>
> Thanks in advance.
>
> Regards,
> LaBird (Benny).
>
>


No, there is no function or vector call when reading from
and writing to memory. For user defined types, one can
put function calls into the assignment, constructors
and destructors.

What do you need this for?

--
Thomas Matthews

C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.raos.demon.uk/acllc-c++/faq.html
Other sites:
http://www.josuttis.com -- C++ STL Library book

 
Reply With Quote
 
 
 
 
LaBird
Guest
Posts: n/a
 
      06-27-2003
Thanks a lot.

My intention is to compute the difference (in contents) of an
object in a period of time, and store the difference as a string.
My plan is, if I write the object A, I can invoke some function to
make a duplicate of the object A', and then when i need to
compute the difference, i can compare the memory contents
between A and A' to get the difference string.

If I can differentiate reads and writes, then I may save some
effort for those objects which have been read only, but not
written during the period, since I can only make A' when I
know a is being written. Thus I can simply check that if A'
does not exist, then any part of object A is not being written.

Regards,
LaBird (Benny).


"Thomas Matthews" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> LaBird wrote:
> > Dear all,
> >
> > I'd like to know if there is any function or program call
> > in C++ (without memory protection support by OS),
> > that can determine whether an object is being read or
> > written? e.g.,
> >
> > a = b + c; // a is being written while b and c are being read
> > a++; // a is being read and written
> >
> > Also, is there any code that can determine the object
> > is a lvalue or rvalue?
> >
> > I think it is possible if a, b and c are user-defined types
> > (as we can overload operator =, + and ++, and so on),
> > but how about primitive types?
> >
> > Thanks in advance.
> >
> > Regards,
> > LaBird (Benny).
> >
> >

>
> No, there is no function or vector call when reading from
> and writing to memory. For user defined types, one can
> put function calls into the assignment, constructors
> and destructors.
>
> What do you need this for?
>
> --
> Thomas Matthews
>
> C++ newsgroup welcome message:
> http://www.slack.net/~shiva/welcome.txt
> C++ Faq: http://www.parashift.com/c++-faq-lite
> C Faq: http://www.eskimo.com/~scs/c-faq/top.html
> alt.comp.lang.learn.c-c++ faq:
> http://www.raos.demon.uk/acllc-c++/faq.html
> Other sites:
> http://www.josuttis.com -- C++ STL Library book
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
I need to write Simple JAVA program to read and write from USB serialto use it with Arduino sahm Java 4 10-15-2012 06:24 PM
want to replace a read only cd transport with read / write transport larya Computer Support 7 09-11-2006 10:21 PM
Determine read/write status of filehandles connected to memory objects. Sisyphus Perl Misc 4 03-17-2006 01:58 AM
nuby: determine method passed and determine the receiver that received the method Peña, Botp Ruby 1 01-24-2004 07:51 PM
Re: How to change Read Only Constraint to Read-Write Isaac VHDL 0 07-10-2003 01:43 PM



Advertisments