Usages split into read/write?

Gunther Piez gpiez at web.de
Sat Jun 26 09:00:03 UTC 2010


On Saturday 26 June 2010 00:01:53 Nicolas Alvarez wrote:

> I think it would be somewhat hard to make the parser to split usages into
> those categories...

Yes, probably. But not harder than writing a C++ parser at the first hand ;-) 
Just look at it from the view of the processor.

> int foo=0; // declaration of foo
And initialization. This falls in the "write" category, maybe subcategory 
"init".

> foo++;     // write? arguably it's reading too
Both read and write. Usually this translates into a read-modify-write 
instruction.

> aaa(foo);  // what is this?
Depends of course from aaa(). If it is a function taking a reference, this is 
neither read or write. A function taking a value parameter is a read. Similiar 
if it is a initialization with a copy constructor.
 
> int* bar = &foo; // or this?
A write/init to bar.
 
> MyClass obj; // declaration of obj
> obj.method(); // what is this doing with obj?
Depends on method. Where is the relation to the question the OP asked? Anyway, 
this is neither a read or write. If there are any read/writes happening in 
method through implictly accessing the *this object, they can be categorized 
there.

- Gunther




More information about the KDevelop mailing list