About atomic

Discuss the OpenMP 3.0 API Specifications with the OpenMP Arch. Review Board. (Read Only)

About atomic

Postby ftinetti » Mon Aug 23, 2010 5:21 am

Hi,

I'm trying to understand the atomic construct just to see if it's worth using instead critical, and reading the 3.0 spec I find (p. 69)
x is an lvalue expression with scalar type.

then, I cannot find "lvalue" in the rest of the document. Am I losing something? How/where is "lvalue" defined?

Thanks in advance.
ftinetti
 
Posts: 575
Joined: Wed Feb 10, 2010 2:44 pm

Re: About atomic

Postby ejd » Tue Aug 24, 2010 5:42 am

OpenMP is a specification that tries to cover three "base" languages - C, C++, and Fortran. As much as possible, the OpenMP specification tries to use the terminology of these base languages when referring to "entities" within the base language. Sometimes that is impossible, since the same concept or entity is used in two or more of the base languages with different "names" or two different concepts use the same "name". For example, as I am writing this I have used two terms that are used by the base languages that have specific meanings (name and entity). In this case, I don't wish them to have the same meaning as the standard definitions, but I don't have better terms to use. Hope this helps.

From the C standard (ISO/IEC 9899), section 6.3.2.1 Lvalues, arrays, and function designators:
An lvalue is an expression with an object type or an incomplete type other than void (53) if an lvalue does not designate an object when it is evaluated, the behavior is undefined. When an object is said to have a particular type, the type is specified by the lvalue used to designate the object. A modifiable lvalue is an lvalue that does not have array type, does not have an incomplete type, does not have a const-qualified type, and if it is a structure or union, does not have any member (including, recursively, any member or element of all contained aggregates or unions) with a const-qualified type.
...
53) The name ‘‘lvalue’’ comes originally from the assignment expression E1 = E2, in which the left operand E1 is required to be a (modifiable) lvalue. It is perhaps better considered as representing an object ‘‘locator value’’. What is sometimes called ‘‘rvalue’’ is in this International Standard described as the ‘‘value of an expression’’.

An obvious example of an lvalue is an identifier of an object. As a further example, if E is a unary expression that is a pointer to an object, *E is an lvalue that designates the object to which E points.
ejd
 
Posts: 1025
Joined: Wed Jan 16, 2008 7:21 am

Re: About atomic

Postby ftinetti » Tue Aug 24, 2010 9:31 am

Thank you.
ftinetti
 
Posts: 575
Joined: Wed Feb 10, 2010 2:44 pm


Return to OpenMP 3.0 API Specifications

Who is online

Users browsing this forum: No registered users and 1 guest

cron