- Copy and move the member object - 1 Update
- legal UTF-8 characters in Identifiers ? - 3 Updates
Pawel Por <porparek@gmail.com>: Mar 27 01:11PM -0700 Hello, Assume there is a struct with a single member object. When creating the object of a struct I want the member object sometimes be copied and sometimes moved. Is the following approach correct ? Assume I don't want to use generic programing. #include <utility> struct Item { Item() {} Item(const Item&) {} Item(Item&&) {} Item& operator=(const Item&) { return *this; } Item& operator=(Item &&) { return *this; } }; struct Container { Item item; Container(const Item& item) : item(item) {} // copying Container(Item&& item) : item(std::move(item)) {} // moving }; int main(int argc, char **argv) { Item a; Container cont(a); // copying Container cont2(std::move(a)); // moving return 0; } |
Jason Vas Dias <jason.vas.dias@ptt.ie>: Mar 27 10:59AM -0700 Good day - I'd really like to be able to define functions with names like : ∀() (\U{FOR_ALL}), or ⭮() , or ⭯() , or : 8704 2200 (1 1) ∀ 'FOR ALL' 8705 2201 (1 1) ∁ 'COMPLEMENT' 8707 2203 (1 1) ∃ 'THERE EXISTS' 8708 2204 (1 1) ∄ 'THERE DOES NOT EXIST' Why can't I use these characters in identifiers ? Would there be any support for submitting an RFC to the standards groups to allow implementations to have some sort of local UTF-8 character white-list policy ? ie. I'd like to develop extensions for GCC and Clang that will allow them to load a UTF-8 character White-List file , then these characters would be allowed regardless of what the standards say about valid identifier characters. Next step is getting a complete dump of what GCC and Clang consider to be valid UTF-8 identifier characters, which is not as straightforward as it should be. I'd most appreciate any helpful advice / informative comments. Thanks & Best Regards, Jason |
Richard Damon <Richard@Damon-Family.org>: Mar 27 03:02PM -0400 On 3/27/23 1:59 PM, Jason Vas Dias wrote: > I'd most appreciate any helpful advice / informative comments. > Thanks & Best Regards, > Jason My understanding is that C++ basically just took the set of characters for identifiers from the recommendation of the Unicode Standard for "Identifiers" (XID_Start, XID_Continue). All the characters you mentioned are defined (I beleive) as operators. My one thought is that the Standard Committee wants to reserve the operators from being identifies in case at some point a method is defined to add new operators. My guess is that GCC and Clang just implement the set defined by the standard, which means going to the UNICODE standard that is applicable for that compiler and looking at its definition of those classes. I wouldn't be surprised if the build process just has as an input, the Unicode class definition file, and a program that parses it to build the needed code for the various things that need that information. Of course, there is nothing to prevent an implementation from accepting additional characters (possibly with a warning or an option) beyond the defined set. |
scott@slp53.sl.home (Scott Lurndal): Mar 27 07:08PM >My one thought is that the Standard Committee wants to reserve the >operators from being identifies in case at some point a method is >defined to add new operators. Actually, there's something to be said for sticking to the portable character set for identifiers, such that the current locale and or character set settings don't matter when compiling the source. |
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page. To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com. |
No comments:
Post a Comment