Thread: Easier Ways of Writing an Average Calculation Program?

  1. #31
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    Quote Originally Posted by laserlight View Post
    So can std::array, I believe, since it is pretty much a thin wrapper over built-in (or C-style, if you prefer) arrays.
    For some of std::array's operations (or member functions) that is true. For some operations it is debatable. For example, .at() does not necessarily qualify as a "thin wrapper" since it does error checking and can throw exceptions, which are not behaviours associated with a built-in array (to use your description, because I'm not looking to get into a C versus C++ debate over a feature that is in both languages). It is also implementation-defined whether such functions are inlined (functions that are not inlined often carry overheads, such as overheads of function calls).

    I'm not incidentally arguing that std::array should not be used. Just like any other comparable capability of the language, it is an option for consideration - I do balk at the repeated assertion that it should be the first choice of one.
    Right 98% of the time, and don't care about the other 3%.

    If I seem grumpy or unhelpful in reply to you, or tell you you need to demonstrate more effort before you can expect help, it is likely you deserve it. Suck it up, Buttercup, and read this, this, and this before posting again.

  2. #32
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by grumpy View Post
    I did not object to your mentioning C++11's array. I even noted in a reply to you it is a valid alternative.

    I did object to your characterising C's array as "mine" because I correctly interpreted (given some of your subsequent comments) you were intending that to belittle the information I gave.

    Technically, the information I gave is as correct as yours - in fact, more so, because you used a term llike deprecate (which has a specific meaning in all C++ standards, including C++11).

    The difference is that you insist of advocating C++-11 features, and belittling anyone who mentions anything else. Given that, in this thread, you turned that belittling behaviour on me, personally, I feel entitled to be resentful.
    I did not belittle you, or anyone else. I did not belittle any information stated thus far, either. I mentioned an alternative, nothing else. Had I intended to belittle anything, I would have pitted std::array against C arrays in my first reply. I didn't, because that was not my intention.
    I have mentioned this before, but I do not generally go against wishes of others who reply in the thread unless I really deem them wrong. The same applies here. I do not think you are wrong, but I do think you left out something useful. Hence, I added that.
    If you feel resentful or belittled, then access my apologies, because once again, it was not my intention.

    I still stick to my belief that std::array is the future. It may be more difficult to use, sure, but all in good time.
    I find it better to mention these newer features to newbies so that they will understand and use them. IMHO, it is better for a newbie to ask - why are you using C arrays instead of std::array instead of simply accepting C arrays as the only alternative.

    /me signing out.
    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.

  3. #33
    Registered User rogster001's Avatar
    Join Date
    Aug 2006
    Location
    Liverpool UK
    Posts
    1,472
    @grumpy, post #28, excellent, enjoyed reading
    Thought for the day:
    "Are you sure your sanity chip is fully screwed in sir?" (Kryten)
    FLTK: "The most fun you can have with your clothes on."

    Stroustrup:
    "If I had thought of it and had some marketing sense every computer and just about any gadget would have had a little 'C++ Inside' sticker on it'"

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Writing numbers in letters is there a easier way ?
    By amadeus111 in forum C Programming
    Replies: 9
    Last Post: 01-27-2013, 07:37 AM
  2. c programming- Help needed writing code for coin calculation
    By avithashali in forum C Programming
    Replies: 3
    Last Post: 11-02-2012, 07:44 AM
  3. Average Calculation Error
    By BamaMarine06 in forum C Programming
    Replies: 2
    Last Post: 10-04-2010, 08:13 PM
  4. different ways to program
    By herWter in forum Windows Programming
    Replies: 3
    Last Post: 07-07-2008, 12:41 AM
  5. How many ways to program a Windows GUI?
    By thetinman in forum Windows Programming
    Replies: 12
    Last Post: 11-29-2006, 09:43 AM