Thread: [Opinions] What to call these functions?

  1. #1
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108

    [Opinions] What to call these functions?

    The title length available isn't really long enough to explain the goal of my thread. I'm sorry about that.

    I want some opinions regarding what to call functions, methods, and operators, that perform a potentially destructive alteration on a reference in some tutorials I'm writing.

    (For those who have no idea what I'm talking about: the upcoming C++ standard will include 'rvalue' references which will naturally allow for move semantics--move semantics at the language, instead of library, level.)

    I've seen a handful of articles on 'rvalue' references. They provide an introduction. They barely scratch the surface. They scarcely hint at how valuable the addition is to the language. (I don't imagine that I'll hit on everything in the tutorials. I don't even desire that. The tutorials would be to complicated. I would like to provide some real suggestions and direction.) I would like to use a consistent and unique name throughout to lend emphasis to that importance.

    I've not seen more than a few articles calling functions using 'rvalue' references anything. The articles I have seen don't agree on what to call them. One article doesn't even name them consistently. They perform a specific operation and are provided for a specific purpose, I think they deserve a specific name.

    Even though the name is closely associated with library implementations of move semantics, I've been calling the relevant constructors "move constructors" and the relevant operators "more operators". I use more specific names in more specific circumstances--like "move with assignment by addition". I like these names.

    None of that helps with freestanding functions and methods. With the addition of move semantics to the language I imagine that three or four overloads will become standard where two or three was common.

    Code:
    some_type do_something(some_type); // 1
    some_type do_something(const some_type &); // 2
    some_type & do_something(some_type &); // 3
    That's all fine. Which ones to provide depends on the purposes and the syntactical and semantic advantage desired.

    Code:
    some_type && do_something(some_type &&); // 4
    What should we call this one? Calling it a "move overload for 'do_something'" sounds promising. What do you think of that?

    Soma

  2. #2
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    I like move overload for "do_something".
    I also like the idea of a tutorial describing rvalue references. I'm looking forward to when the tutorial is finished.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. minix system call pls help for project
    By porvas in forum Linux Programming
    Replies: 2
    Last Post: 06-14-2009, 02:40 AM
  2. seg fault with any function call
    By LegoMan in forum C Programming
    Replies: 5
    Last Post: 04-15-2009, 05:30 PM
  3. temperature sensors
    By danko in forum C Programming
    Replies: 22
    Last Post: 07-10-2007, 07:26 PM
  4. Passing pointers between functions
    By heygirls_uk in forum C Programming
    Replies: 5
    Last Post: 01-09-2004, 06:58 PM
  5. Expression Manipulator v0.2 (bug fixes, functions)
    By ygfperson in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 05-26-2003, 04:52 PM