473,378 Members | 1,492 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Determine read or write ?

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).
Jul 19 '05 #1
2 2103
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

Jul 19 '05 #2
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" <th*************@sbcglobal.net> wrote in message
news:3E**************@sbcglobal.net...
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

Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
by: Christopher W. Douglas | last post by:
I am writing a VB.NET application in Visual Studio 2003. I have written a method that handles several events, such as closing a form and changing the visible status of a form. I have some code...
5
by: David C. Barber | last post by:
I'm trying to determine which user has locked a given record from VB6. I know I can use sp_lock and sp_who, and match up the data to determine which users have locked records in my database,...
3
by: Web Webon | last post by:
Hi everybody! I wonder if this is possible? I need to determine if a client is using "windows classic folders" or anything else. If I instantiate a Shell ActiveX object is there a way of...
4
by: John Baro | last post by:
I need to determine which fonts are human readable. Webdings, wingdings etc.. are not. Is there any easy way to accomplish this? Cheers JB
3
by: Jordan | last post by:
I am dynamically inserting an html <input> tag as text (equivalent of an image button) into a page via a Literal control. Something like this gets inserted: <input type="image"...
0
by: Terry Olsen | last post by:
Using #ZipLib, I'm zipping up large files (100MB & >). I'm using a byte array to read in the file and write out to the zip file. The bigger the chunks I can read in the faster the zipping goes. ...
1
by: darin_dimitrov | last post by:
Is it possible to determine if a property is read-only, write-only or read-write with reflection? Does MemberInfo class contains such information? Thanks
6
by: magix | last post by:
Hi, when I read entries in file i.e text file, how can I determine the first line and the last line ? I know the first line of entry can be filtered using counter, but how about the last line...
6
by: Bob Johnson | last post by:
How can I programmatically determine when a MDI child form has been dragged from one location to another within its MDI parent form? Ideally I'd like to trap some event that occurs when the...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.